WooCommerce Echo价格为USD的架构价格
我所有的产品都有美元。但是,在美国之外的访问者(我正在使用WooCommerce多货币)的价格变化。当价格变化时,模式中的价格也是如此。
那么,我该如何以美元的价格回应价格呢?
示例代码:
"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() ); ?>"
}],
“价格”:“ get_price_html();?&gt;“,我想在美元(第二个报价)中获得价格的地方。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)