Hello,
Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.
Could you please try adding this filter to your site? This code will forcibly display prices in the schema with tax rates included.
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;
});
The filter should be added to your active theme’s functions.php file. Here’s another way to apply the filter using the rankmath.php file:
https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php
Once done, clear your website’s cache and check again.
I hope that helps.
Thank you.
Hi Reinelle,
Thanks for your reply.
I’ve added that code to our staging site and it seems we now have two values.
One is the correct price inc VAT;
One is still showing the price ex VAT;
Heres the link to the rich results;
Kindly advise.
Thank you,
Sam
Hello,
Please try replacing the old one with the following filter to see if that works for you:
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
if(is_product()){
global $product;
$entity['offers']['price'] = wc_get_price_including_tax( $product );
$entity['pricespecification']['price'] = wc_get_price_including_tax( $product );
return $entity;
}
});
Let us know how it goes. Looking forward to helping you.
Thank you.
Thank you but that doesn’t seem to have worked.
Please see here.
Hello,
Can you please try replacing the old one with the following filter to see if that works for you?
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
if(is_product()){
global $product;
$entity['offers']['price'] = wc_get_price_including_tax( $product );
$entity['offers']['pricespecification']['price'] = wc_get_price_including_tax( $product );
return $entity;
}
});
Let us know how it goes. Looking forward to helping you.
Thank you.
Hello,
Can you please confirm, if you have already enabled the taxes
in WooCommerce > Settings > General? Once you have saved the changes, the Tax
tab will appear in the Settings, and from there you can choose to show the tax in your products.
This setting will also make sure that the Schema reflects the correct values for the fields you mentioned and the use of that filters I’ve shared above might be redundant.
Alternatively, you may try adding the following filter:
add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
global $product;
$entity['offers']['price'] = wc_get_price_including_tax( $product );
$entity['offers']['priceSpecification']['price'] = wc_get_price_including_tax( $product );
$entity['offers']['priceSpecification']['valueAddedTaxIncluded'] = "true";
return $entity;
} );
If the issue persists, then we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.
Please do take a complete backup of your website before sharing the information with us.
It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
https://wordpress.org/plugins/temporary-login-without-password/
You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
https://wordpress.org/plugins/wp-security-audit-log/
Looking forward to helping you.
Thank you.
Thank you for your continued assistance.
The last code has now worked thank you.
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/#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.