Single Product Description meta tag

#257071
  • Resolved don vi
    Rank Math free

    Hello,

    Just missing feature how to add “Product description” in the “Product meta description” –

    %excerpt% this one doesn’t fit for us, because it shows a very small amount of text.

    How to put the full product description there?

    thanks

Viewing 15 replies - 1 through 15 (of 19 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.

    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 (long description)

    To summarize, the short description you have set will be prioritized if you’re using the %excerpt% variable for your description.

    In case you wanted to force the use of the long description (full product description), you can create a custom variable for the product’s long description by adding this filter on your site:

    add_action( 'rank_math/vars/register_extra_replacements', function() {
    	rank_math_register_var_replacement(
    		'woo_full_desc',
    		[
    			'name'        => esc_html__( 'Woo Full Desc.', 'rank-math' ),
    			'description' => esc_html__( 'Woo Full Description...', 'rank-math' ),
    			'variable'    => 'woo_full_desc',
    			'example'     => woo_full_desc_callback(),
    		],
    		'woo_full_desc_callback'
    	);
    } );
    function woo_full_desc_callback() {
    	global $post;
    	if ( empty( $post ) ) {
    		return 'Product Description';
    	}
    
    	return wp_strip_all_tags( $post->post_content );
    }

    And here’s a link on how to apply a filter on your site:
    https://rankmath.com/kb/filters-hooks-api-developer/#how-to-add-code-snippets-to-rank-math-php

    After this, add %woo_full_desc% in the SEO description field.

    I hope that helps.

    Thank you, and please don’t hesitate to contact us anytime if you need further assistance with anything else.

    don vi
    Rank Math free

    Thank you very much!

    One more thing, google limits SEO description meta field to approximately ~170 symbols,

    could you correct a code to grab only 170 symbols?

    as this will help us to reduce database size, because we have a lot of products.

    By the way, rank math is surely the best WP-seo plugin from all sides,

    thank you again.

    don vi
    Rank Math free

    Hello,

    it’s possible to limit symbols to 170 ?

    thank you

    Hello,

    Please use this revised filter to only include the first 170 words from the product short description: https://pastebin.com/BTAWLrmM

    Hope this helps solve your issues.

    Don’t hesitate to get in touch if you have any other questions.

    don vi
    Rank Math free

    Miguel!

    thank you very much!

    don vi
    Rank Math free

    Quick question:

    Does this code works the same in Images alt/title attributes?

    https://puu.sh/IamEr/605687b0b2.png

    thanks

    Hello,

    Since this code will only run properly when the page is an actual product page any images that are not on product pages will get the ALT as “Product Description” and that might not be appropriate to have multiple images with that ALT tag.

    So we would refrain from adding this to the setting for the missing ALT tag.

    Hope this helps clarify your doubts.

    Don’t hesitate to get in touch if you have any other questions.

    don vi
    Rank Math free

    Hi,

    just find out, that is “Short product description” field is filled, then this %woo_full_desc% code takes short product description field,

    and if it’s empty, it takes full description field,

    is it possible to make a every time full description?

    will be waiting for your answer,

    thanks!

    Hello,

    I checked on my end and the variable is fetching the full description even if the short description is set. Can you please check again? Here is a quick screencast: https://i.rankmath.com/W2ABjZ

    Looking forward to helping you.

    don vi
    Rank Math free

    Hello,

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

    Thank you.

    don vi
    Rank Math free

    Hi,

    i have updated sensitive information with images

    Hello,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    don vi
    Rank Math free

    Hello,

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

    Thank you.

    don vi
    Rank Math free

    Hi,

    I have updated sensitive data.

    Hello,

    We apologize for the unexpected delays.

    We would like to further debug this issue over your admin dashboard but it seems the access you shared is so limited at the moment. Could you please elevate the access to the admin level so we can access some of the settings pages?

    We are looking forward to helping 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 15 replies - 1 through 15 (of 19 total)

The ticket ‘Single Product Description meta tag’ is closed to new replies.