• Resolved Maarten Belmans

    (@maartenbelmans)


    Hi there,

    How can I know if a price is already converted in a currency?

    For example wc_get_price_to_display() will return a converted price when “Individual fixed prices rules for each product” is ON.

    But when that setting is OFF and we get prices from the exchange rate, then wc_get_price_to_display() will display the original price (so in the default currency).

    I’m wondering if there is some way to know if the price we see is already converted into a currency.

    I’m implementing a plugin with WOOCS so I can code whatever is needed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • So what I want to know: how can I know if a price I see is:

    a) A fixed price
    b) converted via the exchange rate

    Hello

    wc_get_price_to_display() – unfortunately at this stage it is impossible to find out.

    If you have a product ID you can check whether this product has a fixed price for this currency.
    global $WOOF;

    $WOOF->fixed->is_exists($product_id, $current_currency, $type[‘regular’|’sale’])

    Thanks for your reply!

    Followup question:

    I noticed when I set “woocs_is_multiple_allowed” to “no”, that $product->get_price() returns the regular product price. If “woocs_is_multiple_allowed” is set to “yes”, then $product->get_price() will return the converted price.

    Is this normal or a bug? If it is normal, I don’t understand why this setting influences WooCommerce functions. Can you explain?

    Hello

    Yes it’s normal. This setting changes the hooks for price conversion.

    I don’t understand why this setting influences WooCommerce functions. C – because this plugin is designed to convert woocommerce prices.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.