Hello,
Thank you for contacting the support.
Please add the below filter to the website to show the price with tax in the required meta tag:
add_filter( "rank_math/opengraph/facebook/product_price_amount", function( $content ) {
if(!is_product()){
return;
}
global $product;
return wc_get_price_including_tax( $product );
});
This filter can be used to update the same in the Product Schema:
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
if(!is_product()){
return;
}
global $product;
$entity['offers']['price'] = wc_get_price_including_tax( $product );
return $entity;
});
Here’s how you can add the filter:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Please let us know how that goes.
Thank you.
Hi,
Thanks for your help!
Yeah that sorted out JSON+LD and product:price:amount meta tag.
But “twitter:data1” meta tag is still wrong. Could you help me out with that as well?
Why don’t you add a conditional to check if WooCommerce displays the prices including or excluding taxes and calculates the right product schema and meta data?
Hello,
By default, Rank Math doesn’t compute the tax to the price so you would need to apply the filter code my colleague presented.
As for the twitter:data1
can you please share an affected URL so we can take a closer look at it? You may share the URL in the sensitive data section.
Looking forward to helping you.
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.