PRODUCT Description Not Use Template

#114091
  • In console change template for meta-description for PRODUCT type.
    But resulting PRODUCT PAGE ignore it –
    it use default description=short-product-description not my template

    template is

    😍Лучший в Одессе %title% всего за %wc_price% от ресторана Игуана. %wc_shortdesc% Приходите пробовать на Шишкина 48 или закажите доставку 🚀
    Дешево! Вкусно! Бесконтактно!

    ps Title working fine with my template

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for getting in touch with us.

    This is the order we follow to generate meta descriptions for WooCommerce product:
    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

    You can add the following filter to your theme functions.php to override WC excerpt and use the Global template

    /**
     * Use the Description from Global Setting, if the description is missing in the Post metabox
     */
    add_action( 'rank_math/frontend/description', function( $description ) {
     global $post;
     $desc = RankMath\Post::get_meta( 'description', $post->ID );
    
     if ( is_product()) {
     $desc = RankMath\Helper::get_settings( "titles.pt_{$post->post_type}_description" );
     if ( $desc ) {
     return RankMath\Helper::replace_vars( $desc, $post );
     }
     }
    
     return $description;
    });
    

    Hope that helps. If you have any further question(s), please let us know. Thank you.

    Thanks a lot. Work great! (My Template uses Product Short Description too))

    Hello,

    Glad that helped.

    Please feel free to reach out to us again in case you need any other assistance.

    We are here to help.

    Thank you.

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

The ticket ‘PRODUCT Description Not Use Template’ is closed to new replies.