PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Fix for Google Merchant Feeds - Mismatched Value (Wrong Currency in Schema) when using RankMath SEO plugin

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hello, I love the WOOCS plugin thanks, very useful and helpful. I have a snippet here that might help other users. When we tried to upload our products to the Google Merchant Center, they would get disapproved because when the bot crawled our site, only the shop base currency set in the WooCommerce settings would display in the Schema / Structured Data snippets. We started using the RankMath SEO plugin on our website, and found in their forums a filter that we can use with WOOCS to generate multiple offers in the Schema for use in the Google Merchant Center Product Feed.

I tried to get it to dynamically swap the entire"Offer" section based on selected currency in WOOCS, which worked in manual tests, but not when the bot crawled the product page, so the only solution I could find was to provide multiple offers, one for each main currency in our store, (luckily for us, there are only 2 currencies we use, NZD and AUD).

Here below is the code we're using succesfully, added via the Code Snippets Plugin, (but note that this will only work if you're also using the RankMathSEO plugin and have their Structured Data Snippets module enabled):

// Based on source: https://support.rankmath.com/ticket/is-it-possible-to-set-multi-currencies-in-one-schema-in-a-woocommerce-product/
function ssc_schema_dual_offers( $entity ) {
global $product;
$price = $product->get_price();
$url_product = get_permalink( $product->get_id() );
$future = date("Y-m-d", strtotime("+365 days"));
if ( has_term( 'example-category', 'product_cat' ) ) { // (We have it limited to only one category in our store)
unset($entity['offers']);
$entity['offers'] = [
[
'@type' => 'Offer',
'price' => $price,
'priceCurrency' => 'AUD',
'priceValidUntil' => $future,
'availability' => 'https://schema.org/InStock',
'itemCondition' => 'https://schema.org/NewCondition',
'url' => $url_product . '?currency=AUD',
'seller' => [
'@type' => 'Organization',
'@id' => '(Enter your Website URL)',
'name' => '(Enter your store name)',
'url' => '(Enter your Website URL)',
'logo' => '(Enter URL path to your logo image)'
],
'priceSpecification' => [
'price' => $price,
'priceCurrency' => 'AUD',
'valueAddedTaxIncluded' => 'false'
],
],
[
'@type' => 'Offer',
'price' => $price,
'priceCurrency' => 'NZD',
'priceValidUntil' => $future,
'availability' => 'https://schema.org/InStock',
'itemCondition' => 'https://schema.org/NewCondition',
'url' => $url_product . '?currency=NZD',
'seller' => [
'@type' => 'Organization',
'@id' => '(Enter your Website URL)',
'name' => '(Enter your store name)',
'url' => '(Enter your Website URL)',
'logo' => '(Enter URL path to your logo image)'
],
'priceSpecification' => [
'price' => $price,
'priceCurrency' => 'NZD',
'valueAddedTaxIncluded' => 'false'
],
],
];
return $entity;
}
};
add_filter( 'rank_math/snippet/rich_snippet_product_entity', 'ssc_schema_dual_offers', 999, 2 );

Hello

Schema - always displayed in base currency. To disable  it  in file - \wp-content\plugins\woocommerce-currency-switcher\classes\woocs.php - delete  this  code - https://share.pluginus.net/image/i20220829082049.png

Bots crawl sites only in the base currency. To disable  it  in file - wp-content\plugins\woocommerce-currency-switcher\index.php - delete  this  code - https://share.pluginus.net/image/i20220829082432.png