All my products have prices in USD. But the prices get changed for visitors out of the US (I'm using WooCommerce Multi-currency). When the prices change, so do the prices in the schema.
So, how can I echo the price in USD?
A sample code:
"offers": [{
"@type": "Offer",
"availability": "http://schema.org/<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>",
"price": "<?php echo $product->get_price(); ?>",
"priceValidUntil": "<?php echo date('Y', strtotime('+1 year')); ?>-11-05",
"priceCurrency": "<?php echo get_woocommerce_currency(); ?>",
"url": "<?php echo get_permalink( $product->get_id() ); ?>"
},{
"@type": "Offer",
"availability": "http://schema.org/<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>",
"price": "<?php $product->get_price_html(); ?>",
"priceValidUntil": "<?php echo date('Y', strtotime('+1 year')); ?>-11-05",
"priceCurrency": "USD",
"url": "<?php echo get_permalink( $product->get_id() ); ?>"
}],
The "price": "get_price_html(); ?>", is where I want to have price in USD (2nd offer).