Background of the issue:
Hello, we recently started using the plugin Mergado Pack to generate feed of our products for various ecommerce platforms. Unfortunately we noticed that the feed sometimes contains prices in EUR instead of CZK which is our default (and intended) currency for the feeds. Mergado doesn't support WCML, so it's my turn to resolve this problem. The feed is generated either manually by accessing a specific URL, or by WP Cron. It seems that when the feed is generated using the cron job, the currencies get mixed up. The easiest solution I could think of was to override the prices by specifying the currency manually using a filter. Mergado exposes a filter called `mergado_product_feed__product` that I can use to override the prices. It is actually kinda simple, so after some research I came up with the following code which I placed inside `functions.php`. It seems to work fine while testing this locally but I am not sure whether it will work with the cron job since I don't understand how `wcml_convert_price` will work when e.g. `wc_get_price_excluding_tax($product, $price_args)` returns the price in EUR. Will it correctly convert the price to CZK?:
Additionally, converting each of the prices manually looks a bit too complicated. Isn't there something easier I could do, to kinda force WCML to always use CZK prices when the feed is generated? And if not, isn't there a way to get the discounted/not discounted VAT included/excluded prices already in the CZK currency?
Symptoms:
The feed sometimes contains prices in EUR instead of CZK, especially when generated using the cron job.
Questions:
Will the provided code correctly convert the price to CZK when `wc_get_price_excluding_tax($product, $price_args)` returns the price in EUR?
Is there an easier way to force WCML to always use CZK prices when the feed is generated?
Is there a way to get the discounted/not discounted VAT included/excluded prices already in the CZK currency?
Тема '[Закрытые] WCML Prices during Mergado Product Feed generation' закрыта для новых ответов.