Woocommerce single product description does not use the default setting

#322051
  • Resolved Chad Reitsma
    Rank Math free

    Hey guys,

    We have set up a default Single Product Description in the Titles & Meta settings, like this: “Buy %title% online.”

    When I view the products meta with view-source it does not use the default we set. Instead, it shows the products short description.

    Example:
    <meta name=”description” content=”Products short description is here, but it should be using our default from the settings panel”>

    Expected result:
    <meta name=”description” content=”Buy Product name online”>

    It DOES work within the og:title, but not in the actual meta description.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Sorry guys, digging a little deeper – it looks like it is working on SOME products, but not on others. Even though we don’t have a description set in the Meta snippet. I’ll do some more digging and post the solution if I find it.

    Prabhat
    Rank Math agency

    Hello,

    Thank you for contacting us.

    This is the order we follow to generate meta descriptions for WooCommerce products:
    1. Content from SEO Description field
    If that is missing, then:
    2. WooCommerce Excerpt or Product Short Description
    If that is missing, then:
    3. Template From General Settings in WordPress Dashboard > Rank Math > Titles & Meta > Products
    If that is missing, then:
    4. Auto generated Content from the product page

    If you wish to give more preference to the description set in Titles & Meta > Products, then you can add the below code in your theme’s functions.php file:

    add_action( 'rank_math/frontend/description', function( $generated ) {
    	if ( ! is_product() ) {
    		return $generated;
    	}
    	global $post;
    	$desc = RankMath\Helper::get_settings( "titles.pt_product_description" );
    	$desc = RankMath\Helper::replace_vars( $desc, $post );
    	return empty( $desc ) ? $generated : $desc;
    });
    

    Hope this helps.

    Thank you.

    Thanks Prabhat. The issues seems to have resolved itself, but we didn’t do anything. Does RankMath cache any of this data?

    Sorry, I was looking at the Product Title. Your snippet worked, thank-you!

    Prabhat
    Rank Math agency

    Hello,

    We are super happy that we could address your concern. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind us asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

    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 5 replies - 1 through 5 (of 5 total)

The ticket ‘Woocommerce single product description does not use the default setting’ is closed to new replies.