Variable formula does not work on old products

#149937
  • Resolved Sill
    Rank Math free

    Hello
    Filled out title and description formulas for product pages
    Everything works on newly created products
    On older products, the title is taken from the variable formula, and the description is taken from the page text
    How do I make the variable formula for descriptions work for all products?
    thank

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    The default meta title and description will only apply to new products. Since you wanted to change the variables to your existing products, you can bulk edit your product’s keywords, title, and description by following this screencast I’ve created:
    https://i.rankmath.com/elFu0C

    You can also check this link for more information:
    https://rankmath.com/kb/bulk-editing-in-rank-math/#bulk-editing-products

    I hope that helps. Thank you, and looking forward to your update.

    Hello,

    As my colleague mentioned, the default meta description will only apply to new products. However, for your requirement, following snippet can be used to generate meta descriptions for all products from global settings.
    Please place the snippet into themes > funtions.php

    
    /**
     * Use the Description from Global Setting for single product
     */
    add_action( 'rank_math/frontend/description', function( $description ) {
    	global $post;
    	// single product 
    	if(is_product()){
    		$desc = RankMath\Post::get_meta( 'description', $post->ID );
    		if ( ! $desc ) {
    			$desc = RankMath\Helper::get_settings( "titles.pt_{$post->post_type}_description" );
    			if ( $desc ) {
    				return RankMath\Helper::replace_vars( $desc, $post );
    			}
    		}
    	}
    	return $description;
    });

    Or you can do bulk edit option by following screencast.
    https://i.rankmath.com/elFu0C

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else. Thanks.

    Sill
    Rank Math free

    thank
    I will try

    Sill
    Rank Math free

    Does not work
    All products have a meta description formula
    But in the product cards again the text from the page

    Sill
    Rank Math free

    thank
    I can’t edit the code
    Screencast won’t open

    Sill
    Rank Math free

    Screencast looked
    I did everything the same
    Formula meta description failed on product page
    In the description, the beginning of the text from the page

    Hello,

    Please share your WP and FTP details in the sensitive data section so we can check.

    Also, share a product page where it isn’t working so we can use that to test if the code works or not.

    Sill
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    Thank you for following up.

    FTP is used to access your website’s root directory (website files). You can coordinate with your web host to give you FTP credentials for your website. Or, if you’re using cPanel, you can include the login credentials in the designated Sensitive Data section.

    Please also add the product URL to test the filter to make sure if it’s working or not.

    I hope that helps. Thank you, and looking forward to your update.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)

The ticket ‘Variable formula does not work on old products’ is closed to new replies.