Hello @gsmtricks,
Thank you for reaching out to us.
This is the order we follow to generate meta descriptions for WooCommerce products:
1. Content from the 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 (long description)
In this case, if you want to use the long description (product description you mentioned above) and shorten it a bit, you can use and modify this filter to create a custom variable for that:
https://pastebin.com/FQRtjn68
And here’s a guide on how you can add a filter to your website:
https://rankmath.com/kb/filters-hooks-api-developer/
After this, you can use the %woo_full_desc%
variable in the SEO description or single product description field. You can then modify the number 160 in the filter to change the character limit.
Please note that the filter may not be visible while editing the products, as it only works when your products load in a browser. You can check the published/saved product’s meta description via its source code.
You can also check the product’s meta description using this tool:
https://rankmath.com/tools/meta-tag-analyzer/
We hope that helps.
Thank you for the answer.
Very strange.
I have edited the product – no SEO description (at least manually typed)
Then I change the settings and put “TEST”
As a result – the product description is still without changes.
Hello @gsmtricks,
Can you please record and share a screencast of the issue so we can check and assist you further? You can use a tool like https://loom.com/ to record and share the screencast.
Looking forward to helping you. Thank you.
Hello @gsmtricks,
Since you are adding the description in the Titles & Meta, your short description will override that. Please add the filter given below to add the description from the global settings. Please note that the filter will add the correct description in the front end but you will still see the short description in the snippet editor of the meta box.
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 that helps. Let us know if you need any other assistance.