• Resolved BERJAYArudolfl

    (@rudolfl)


    Hi

    As my site is using multiple currencies, I have a small piece of code that adds currency code (AUD, USD, etc..) to the price by hooking into ‘woocommerce_price_format’ filter. This is called from wc_price() function. This function is normally used to generate HTML version of the price.

    The issue I have is that plugin using this wc_price() and currency code makes its way into the feed. Price appears as “$100 AUD”, for example. I think, for the feed generation purposes, get_price() function of the WC_Product object has to be called.

    In any case, any ideas how to get around this conflict?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support BERJAYATanjir Al Mamun

    (@tanjiralmamun)

    Hi @rudolfl,

    Our plugin includes product prices without currency symbols in the feed. This is intentional, as we do not use the wc_price() function for price formatting. Instead, we retrieve raw prices directly using the get_price() method from the WC_Product object.

    If you’d like to review the implementation, you can find the relevant logic in the following file:

    wp-content/plugins/woo-product-feed-pro/classes/class-get-products.php

    → Check around line 2606 of that file for the details.

    Thanks!

    Thread Starter BERJAYArudolfl

    (@rudolfl)

    Hi

    I thought this to be the case as I did a quick look through your code. And this is what I would expect for the feed.

    But… My code uses ‘‘woocommerce_price_format’ hook to show currency code on prices. This causes prices to appear with currency symbol in the feed. As soon as I disable my hook, prices in the feed are back to being just numeric. So, not sure what is happening.

    Rudolf

    Plugin Support BERJAYAJeff Alvarez

    (@superlemon1998)

    Hi @rudolfl ,

    We aren’t able to provide further support regarding the currency as we have Elite plugins that have integrated features with multicurrency.

    You could try using a hook to modify how the values are set on the feed:

    function modify_product_feed_product_id($product_data) {
    if (isset($product_data[‘id’])) {
    $product_data[‘id’] = ‘TEST_ID_12345’; // Set to a test value
    }
    return $product_data;
    }
    add_filter(‘adt_get_product_data’, ‘modify_product_feed_product_id’, 10, 1);

    Thread Starter BERJAYArudolfl

    (@rudolfl)

    Thank you for sharing this hook. I will definitely try it.

    Rudolf

    The answers in this thread are quite helpful. Thanks to rodulfl for asking and for the excellent answers. Preeesh!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Prices format’ is closed to new replies.