Tax not included in Rankmath Product Schema

#337915
  • Hi guys,

    I’ve noticed that my Woocommerce shop products can’t be accepted by Google Merchant Center because the price specified in product feed varies from what is on a website.

    The product prices are entered excluding tax, tax rate is specified and they are shown ‘including tax’

    I did a little digging and it seems the problem lies not in what is “visible” on a website, but what is provided in the schema that is generated by your plugin.

    How can I change this, so the price includes tax in schema?

    Take a look:
    Schema difference in price (tax related)

Viewing 1 replies (of 1 total)
  • 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.

    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.

Viewing 1 replies (of 1 total)

The ticket ‘Tax not included in Rankmath Product Schema’ is closed to new replies.