Using woocommerce rich snipt

  • Hi there How can we use the woocommerce product description for seo description. I used this code %excerpt% to pull the data it’s gathering the data from short description not from the product description. I’m not using the short description always using product description. Please help me to get the way of it

    Thanks and regard
    Rafilathif

    • This topic was modified 1 month ago by Rafilathif.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Hello,

    Thank you for contacting Rank Math today.

    If you would like to use the product short description, kindly change the variable to %wc_shortdesc%

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hello,

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

    Thank you.

    Hello,

    Thank you for contacting Rank Math today.

    This will require a bit of customization since Rank Math will check if the short description exists first before loading the long description.
    Here is a code snippet that you can use only on the frontend to load a custom description:

    /**
     * Allow changing the meta description sentence from within the theme.
     *
     * @param string $description The description sentence.
     */
    add_filter( 'rank_math/frontend/description', function( $description ) {
    	return $description;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​

    No i don’t want to use the short Description currently it’s taking the information from that. See this screenshot https://snipboard.io/FyruOM.jpg

    I need to get this information from product description where is showing in front end under the Description tab see the screenshot https://snipboard.io/WNTElr.jpg

    I can share with you my login Details If you want please check
    you can check these products
    https://supperkart.com/zain-sunflower-oil/
    Added short description and Product Description

    https://supperkart.com/omo-liquid-laundry-detergent/
    Added only Product Description

    I need to gather the SEO description from Product Description

    Hello,

    Thank you for contacting Rank Math today.

    I have checked this post and https://supperkart.com/omo-liquid-laundry-detergent/ and the right description is generated from the product description as you can see below:
    Screenshot

    Removing the short description works as you can see above.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Yes it’s work But i don’t want to use the short description even i update short description for my product always i need to get from the product description how can i set that because currently i update the information to both and it’s taking from short description and i’m not updating the SEO optimized work to that

    I’m looking like you refer me above for short description this %wc_shortdesc%
    What is for Product description

    Thanks

    Hello,

    Thank you for contacting Rank Math today.

    You can add the following code snippet to your theme’s functions.php file to get the long product description and add this to your meta description:

    /**
     * Allow changing the meta description sentence from within the theme.
     *
     * @param string $description The description sentence.
     */
    add_filter( 'rank_math/frontend/description', function( $description ) {
    	   global $post; 
    	   if(is_singular( 'product' )){
    
    		    $description = apply_filters( 'the_content', $post->post_content );
    			return '' !== $description ? wp_html_excerpt( $description, 156 ) : '';
    		}
    	    return $description;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​

    I Added the code like this https://snipboard.io/md6PnE.jpg and not work for me still it’s showing the short description Please check this https://snipboard.io/6KWjGn.jpg

    And i have shared my login detail above if you can check my code in child theme functions.php

    Thanks and regards
    Rafilathif

    Hello,

    Thanks for getting back to me, I am not sure why we never got a notification for this reply.

    The code will only work on the frontend. Please inspect the page source on the single products and let us know how this goes.

    Thank you.

    So for the long description to be the preferred one that I have to put?

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

You must be logged in to reply to this ticket.