Tax not displaying in product meta

#415316
  • Resolved Mr. T
    Rank Math free

    Hi,

    Why does not Rank Math display product price including taxes in the following (even though I’ve setup WooCommerce to enter prices excluding tax and display them with taxes)?
    <meta property=”product:price:amount” content=”” />
    <meta name=”twitter:data1″ content=”” />
    (LD+JSON, offers price in Product Schema)

    How can i get the above meta/schema to show prices including taxes?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Prabhat
    Rank Math agency

    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.

    Mr. T
    Rank Math free

    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.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Tax not displaying in product meta’ is closed to new replies.