Mismatch value error, need assistance with schema
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 pleaseIf 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.
Quote from Pablo Borysenco on March 10, 2023, 13:11I checked everything is correct - Your rate for all currencies is 1
So 11*1 = 11 11USD = 11CAD
I checked everything is correct - Your rate for all currencies is 1
So 11*1 = 11 11USD = 11CAD
Quote from Natasha on March 10, 2023, 13:36All product on the site have fixed prices in every currency (see screenshot: https://imgur.com/a/tt5TJR3). Prices in different currencies are not calculated by a rate on the site, unless the rate is 1 x fixed price?
Example:
Published price on website is $88 CAD
Published price on website is $68 USD
Schema is outputting $11 CAD and $11 USD for that CAD product variation: https://imgur.com/a/E99ljvu
It's outputting the same price for CAD and USD, and it choosing the wrong variation price (it's choosing the travel size US price instead of jumbo size price).
How do I fix?
All product on the site have fixed prices in every currency (see screenshot: https://imgur.com/a/tt5TJR3). Prices in different currencies are not calculated by a rate on the site, unless the rate is 1 x fixed price?
Example:
Published price on website is $88 CAD
Published price on website is $68 USD
Schema is outputting $11 CAD and $11 USD for that CAD product variation: https://imgur.com/a/E99ljvu
It's outputting the same price for CAD and USD, and it choosing the wrong variation price (it's choosing the travel size US price instead of jumbo size price).
How do I fix?
Quote from Natasha on March 10, 2023, 14:05Should I be changing any of the FOX WOOCS settings so that schema outputs the fixed price instead of the default US price for all currencies?
Here's screenshots of the FOX WOOCS settings, Individual fixed price rules for each product is enabled.
Should I be changing any of the FOX WOOCS settings so that schema outputs the fixed price instead of the default US price for all currencies?
Here's screenshots of the FOX WOOCS settings, Individual fixed price rules for each product is enabled.
Quote from Pablo Borysenco on March 13, 2023, 12:24Hello Natasha
All product on the site have fixed prices - Well then of course all my code doesn't matter. You can delete this
try to change code - https://c2n.me/4i2NZNm.png
if (class_exists('WOOCS')) {
global $WOOCS;
$curr = $WOOCS->current_currency
if($curr!='USD'){
$WOOCS->set_currency('USD');
}
$price_usd = $product->get_price();
$WOOCS->set_currency('CAD');
$price_cad = $product->get_price();
$WOOCS->set_currency($curr);
}
Hello Natasha
All product on the site have fixed prices - Well then of course all my code doesn't matter. You can delete this
try to change code - https://c2n.me/4i2NZNm.png
if (class_exists('WOOCS')) {
global $WOOCS;
$curr = $WOOCS->current_currency
if($curr!='USD'){
$WOOCS->set_currency('USD');
}
$price_usd = $product->get_price();
$WOOCS->set_currency('CAD');
$price_cad = $product->get_price();
$WOOCS->set_currency($curr);
}
Quote from Natasha on March 16, 2023, 06:43Thank you so much for your help and sorry for the late reply.
I added the code, but I'm getting an error, see screenshot: https://imgur.com/a/SanvLtu
Also there's one line of code that is in my original code, but not in yours, see screenshot (line 303): https://imgur.com/a/tfSHeS4 and compare to to your code: https://c2n.me/4i2NZNm.png Should I delete that line as well? (I tried deleting it, but still got the other error above).
Thank you so much for your help and sorry for the late reply.
I added the code, but I'm getting an error, see screenshot: https://imgur.com/a/SanvLtu
Also there's one line of code that is in my original code, but not in yours, see screenshot (line 303): https://imgur.com/a/tfSHeS4 and compare to to your code: https://c2n.me/4i2NZNm.png Should I delete that line as well? (I tried deleting it, but still got the other error above).
Quote from Pablo Borysenco on March 16, 2023, 11:43Hello
I delete that line as well? - Yes
Please try yhis code:
if (class_exists('WOOCS')) {
global $WOOCS;
$curr = $WOOCS->current_currency;
if($curr!='USD'){
$WOOCS->set_currency('USD');
}
$price_usd = $product->get_price();
$WOOCS->set_currency('CAD');
$price_cad = $product->get_price();
$WOOCS->set_currency($curr);
}
Hello
I delete that line as well? - Yes
Please try yhis code:
if (class_exists('WOOCS')) {
global $WOOCS;
$curr = $WOOCS->current_currency;
if($curr!='USD'){
$WOOCS->set_currency('USD');
}
$price_usd = $product->get_price();
$WOOCS->set_currency('CAD');
$price_cad = $product->get_price();
$WOOCS->set_currency($curr);
}
Quote from Natasha on March 16, 2023, 14:16Thank you! I added the code and was able to save it without errors. But when I ran a url through schema validator it's still outputting the same price for both USD and CAD, and choosing wrong variation.
See screenshot: https://imgur.com/a/HZfDV84
This is the url I tested with schema validator: https://www.inspirebeautyshop.com/product/suntegrity/5in1-face-sunscreen-spf30-tinted/?attribute_pa_shade-suntegrity=golden-light&attribute_pa_grams=2-oz¤cy=CAD
Here's the code:
add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {if ( ! is_product() ) {return $entity;}$product = wc_get_product( get_the_ID() );if ( ! $product->is_type( 'variable' ) ) {return $entity;}$variations = $product->get_available_variations();if ( ! empty( $variations ) ) {$offers = [];foreach ( $variations as $variation ) {$price_valid_until = get_post_meta( $variation['variation_id'], '_sale_price_dates_to', true );$offers[] = ['@type' => 'Offer','description' => strip_tags( $variation['variation_description'] ),'price' => $variation['display_price'],'priceCurrency' => get_woocommerce_currency(),'availability' => $variation['is_in_stock'] ? 'https://schema.org/InStock' : 'https://schema.org/OutOfStock','itemCondition' => 'NewCondition','priceValidUntil' => $price_valid_until ? date_i18n( 'Y-m-d', $price_valid_until ) : '2025-12-31','url' => $product->get_permalink(),'sku' => $variation['sku'],'gtin' => $variation['gtin'],];}}$entity['offers'] = $offers;return $entity;} );// fix for google merchant centre crawlers picking up wrong currency for cad vs usd pages// 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;if (class_exists('WOOCS')) {global $WOOCS;$curr = $WOOCS->current_currency;if($curr!='USD'){$WOOCS->set_currency('USD');}$price_usd = $product->get_price();$WOOCS->set_currency('CAD');$price_cad = $product->get_price();$WOOCS->set_currency($curr);}$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_usd,'priceCurrency' => 'USD','priceValidUntil' => $future,'availability' => 'https://schema.org/InStock','itemCondition' => 'https://schema.org/NewCondition','url' => $url_product . '?currency=USD','seller' => ['@type' => 'Organization','@id' => 'https://www.inspirebeautyshop.com/','name' => 'Inspire Beauty','url' => 'https://www.inspirebeautyshop.com/','logo' => 'https://www.inspirebeautyshop.com/wp-content/uploads/2021/02/inspire_beauty.png'],'priceSpecification' => ['price' => $price_usd,'priceCurrency' => 'USD','valueAddedTaxIncluded' => 'false'],],['@type' => 'Offer','price' => $price_cad,'priceCurrency' => 'CAD','priceValidUntil' => $future,'availability' => 'https://schema.org/InStock','itemCondition' => 'https://schema.org/NewCondition','url' => $url_product . '?currency=CAD','seller' => ['@type' => 'Organization','@id' => 'https://www.inspirebeautyshop.com/','name' => 'Inspire Beauty','url' => 'https://www.inspirebeautyshop.com/','logo' => 'https://www.inspirebeautyshop.com/wp-content/uploads/2021/02/inspire_beauty.png'],'priceSpecification' => ['price' => $price_cad,'priceCurrency' => 'CAD','valueAddedTaxIncluded' => 'false'],],];return $entity;//}};add_filter( 'rank_math/snippet/rich_snippet_product_entity', 'ssc_schema_dual_offers', 999, 2 );
Thank you! I added the code and was able to save it without errors. But when I ran a url through schema validator it's still outputting the same price for both USD and CAD, and choosing wrong variation.
See screenshot: https://imgur.com/a/HZfDV84
This is the url I tested with schema validator: https://www.inspirebeautyshop.com/product/suntegrity/5in1-face-sunscreen-spf30-tinted/?attribute_pa_shade-suntegrity=golden-light&attribute_pa_grams=2-oz¤cy=CAD
Here's the code:
Quote from Pablo Borysenco on March 17, 2023, 10:23Hello
Ok! Please drop me wp-admin+FTP access - https://share.pluginus.net/image/i20230222134241.png -> https://share.pluginus.net/image/i20230222134615.png
Hello
Ok! Please drop me wp-admin+FTP access - https://share.pluginus.net/image/i20230222134241.png -> https://share.pluginus.net/image/i20230222134615.png
Quote from Natasha on March 17, 2023, 10:40Ok thanks. I dropped the logins. The code from yesterday is still there, I didn't delete it.
Ok thanks. I dropped the logins. The code from yesterday is still there, I didn't delete it.
Quote from Pablo Borysenco on March 17, 2023, 15:22Hello
Please do a test
Hello
Please do a test
Quote from Natasha on March 18, 2023, 08:57Thank you for all you help.
I tested and it's now outputting a different price for USD and CAD (not same price for both currencies like before), but for some reason it still outputs the wrong variation price (it choses the lowest price).
The biggest problem though, I'm getting 'critical error' on all single product pages (not on product pages that have variations).
Here's screenshot of the woocommerce error log: https://imgur.com/a/Ron3sj1
According to the error log, the critical error is coming from this line: https://imgur.com/a/kx7N2lk
I've reverted the code back to the original code (and kept a copy of the code you added).
Thank you for all you help.
I tested and it's now outputting a different price for USD and CAD (not same price for both currencies like before), but for some reason it still outputs the wrong variation price (it choses the lowest price).
The biggest problem though, I'm getting 'critical error' on all single product pages (not on product pages that have variations).
Here's screenshot of the woocommerce error log: https://imgur.com/a/Ron3sj1
According to the error log, the critical error is coming from this line: https://imgur.com/a/kx7N2lk
I've reverted the code back to the original code (and kept a copy of the code you added).
Quote from Pablo Borysenco on March 20, 2023, 11:59Hello
The problem is with this function - $product->get_price(); - Perhaps you have third party code that overrides this function (using a hook)
it still outputs the wrong variation price (it choses the lowest price). - This has nothing to do with my plugin, this function displays such a price
Does the old code work for simple products?
Hello
The problem is with this function - $product->get_price(); - Perhaps you have third party code that overrides this function (using a hook)
it still outputs the wrong variation price (it choses the lowest price). - This has nothing to do with my plugin, this function displays such a price
Does the old code work for simple products?
Quote from Natasha on March 20, 2023, 14:25Hi thank you for your help.
I don't get the critical error on simple product pages with the old code. Schema also outputs the same price for both currencies for both simple products and variation products with the old code (same problem with both types of product but the new code seemed to fix the schema for variations products, but not the simples products).
Here's a simple product url: https://www.inspirebeautyshop.com/product/noto-botanics/hydra-highlighter-stick/?currency=CAD
Here's screenshot of schema validator (using old code): https://imgur.com/a/y7x3E0w
Hi thank you for your help.
I don't get the critical error on simple product pages with the old code. Schema also outputs the same price for both currencies for both simple products and variation products with the old code (same problem with both types of product but the new code seemed to fix the schema for variations products, but not the simples products).
Here's a simple product url: https://www.inspirebeautyshop.com/product/noto-botanics/hydra-highlighter-stick/?currency=CAD
Here's screenshot of schema validator (using old code): https://imgur.com/a/y7x3E0w
Quote from Pablo Borysenco on March 21, 2023, 15:32Hello
Please do a test
Hello
Please do a test