Products description

#2400
  • Resolved Stu Nikolov
    Rank Math free

    Hello guys, is there somebody who have problem with the “single product description” meta settings? For example I have a couple of values, but on the product page showing only the short description.

    I changed my values from Dashboard > Rank Math > Titles & Meta > Products to %wc_shortdesc% %title% from %wc_price%and showing only shortdesc.
    Do you have any idea? I tried with another woocommerce installation but with the same result.

    • This topic was modified 4 years, 11 months ago by Stu Nikolov.
Viewing 14 replies - 1 through 14 (of 14 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    I have been able to reproduce this issue on my end and I have just raised this with our dev team for more investigation.
    Please edit the variables that can be used on the product descriptions from the Rank Math metabox while editing the products as we look into this.

    We appreciate your patience. Thank you.

    ​​​​​​​

    Thank you for the prompt reply, Michael. Unfortunately, metabox it doesn’t work for me because I have more that 5k products.

    HI Stu,

    Thanks for the response.

    We will be in touch as soon as we have some information from our dev team.

    Thank you.

    Hello,

    Sorry for the confusion above. This is not the issue, that’s how description works in the Rank Math plugin. If a description is not added in the Post meta box then the post excerpt ( product short description in Product post type ) is taken as the description.

    You can use below filter code to use value added in Settings for the 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 ) {
        if ( is_singular( 'product' ) ) {
            global $post;
            $description = RankMath\Post::get_meta( 'description', $post->ID );
            if ( '' !== $description ) {
                return $description;
            }
    
            $value = RankMath\Helper::get_settings( 'titles.pt_product_description' );
            return '' !== $value ? RankMath\Helper::replace_vars( $value, [] ) : '';
        }
    
        return $description;
    });
    

    Hope that helps. Thank you.

    • This reply was modified 4 years, 11 months ago by Pratik.

    Maybe I mess somewhere? https://imgur.com/1bVzmC1

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Please edit the sensitive data section and add some temporary admin access to your site so that we can have a look at this for you.

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Thank you for the provided support. Sensitive data is updated.

    Hello, is there any solution?

    Todd
    Rank Math free

    Hi Stu,

    Could you please check again?

    We have edited the code in your theme’s functions.php file.

    Instead of returning it, the code was echoing which was causing the problem.

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

    Thanks for updating Todd, unfortunately still not showing the short description and product title.

    RankMath Settings

    Meta Description

    Hello,

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

    Thank you.

    Todd
    Rank Math free

    Hello,

    Sorry, it took a while.

    We have fixed the issue. You can take a look now:
    product description

    We removed the previous code and added this to the theme’s functions.php file:

    add_filter( 'rank_math/frontend/description', function( $description ) {
        if ( is_singular( 'product' ) ) {
            global $post;
            $description = RankMath\Post::get_meta( 'description', $post->ID );
            if ( '' !== $description ) {
                return $description;
            }
    
            $value = RankMath\Helper::get_settings( 'titles.pt_product_description' );
            $product = wc_get_product( $post->ID );
            $value = str_replace( '%title%', $product->get_title(), $value );
            $value = str_replace( '%wc_shortdesc%', $product->get_short_description(), $value );
            return '' !== $value ? RankMath\Helper::replace_vars( $value, $product ) : '';
        }
    
        return $description;
    });

    Please let us know if you need help with anything else.

    Thank you guys, it’s working perfectly.

    Todd
    Rank Math free

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

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

    If you do 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.

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

The ticket ‘Products description’ is closed to new replies.