Hello,
Thanks for contacting us and sorry for the inconvenience caused.
For variable products, we don’t add the price in the meta tags because the product can have multiple prices, and as such, the price is not added because there are multiple options for that.
Having said that, if you would like to print the first variation price there to pass the validation you can use the following filter:
add_action( 'rank_math/head', function() {
global $product;
if (!is_product() || !$product->is_type('variable') ) {
return;
}
global $post;
$price = get_post_meta($post->ID, '_price', true);
echo '<meta property="product:price:amount" content="' . $price . '" />';
echo '<meta property="product:price:currency" content="EUR" />';
}, 99 );
For the ID, you can modify and use the following filter:
add_action( 'rank_math/head', function() {
if ( ! is_product() ) {
return;
}
global $post;
echo '<meta property="product:retailer_item_id" content="' . $post->ID . '" />';
}, 99 );
You can apply this filter by following the steps illustrated here: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope this helps solve your issues.
Don’t hesitate to get in touch if you have any other questions.
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.