-
Hello, i found usefull function, that replace short_desc if no data entered on frontend with Title – Price currency. – Brand. I want to add stock status between Title and Price, how can i do that? That’s the function, it’s worked fine:
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;
});
The ticket ‘Stock status in SEO rank_math/frontend/description’ is closed to new replies.