Remove pricing schema for Woocommerce products

#368433
  • Resolved Jon Insley
    Rank Math free

    Hi,

    I’m trying to remove the author schema for Woocommerce products.

    I tried this in functions.php but it’s not working:

    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    unset($entity['offers']['price']);
    unset($entity['offers']['priceSpecification']);
    unset($entity['offers']['priceValidUntil']);
    unset($entity['offers']['priceCurrency']);
    unset($entity['mainEntityOfPage']['author']);

    return $entity;
    });

    Also, how do I remove these meta tags?

    <meta property=”product:price:amount” content=”5.99″ />
    <meta property=”product:price:currency” content=”CAD” />
    <meta property=”product:availability” content=”instock” />
    <meta name=”twitter:label1″ content=”Price” />
    <meta name=”twitter:data1″ content=”$5.99 CAD” />

Viewing 7 replies - 1 through 7 (of 7 total)
  • I found this for the og:price but the Twitter price still shows in the meta tags. How can I remove that?

    add_filter( ‘rank_math/woocommerce/og_price’, ‘__return_false’ );

    Found the twitter meta removal here:
    https://support.rankmath.com/ticket/remove-twitterdata1-and-twitterlabel1/

    So is there a way to remove the author on products?

    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.

    The page you have shared requires a username and password for viewing. Could you please also share them in the sensitive data section to check?

    Meanwhile, please try using this filter to remove the author name in the product schema:

    add_filter( "rank_math/snippet/rich_snippet_product_entity", function ( $entity ) {
    	if ( isset( $entity['author'] ) ) {
    		unset( $entity['author'] );
    
    		return $entity;
    	}
    	return $entity;
    } );

    I hope that helps.

    Thank you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    It seems you have managed to remove the meta tags already.

    As for the author schema, can you please let us know if you have applied the recent filter code my colleague provided?

    If it doesn’t reflect on the frontend, please try to clear your website cache and check again.

    Looking forward to helping you.

    No the function to remove the author didn’t work.

    I disabled the password protection now so it can be run through Google Rich Results Test.

    Hello,

    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.
    Sensitive Data Section

    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/

    We really look 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 7 replies - 1 through 7 (of 7 total)

The ticket ‘Remove pricing schema for Woocommerce products’ is closed to new replies.