Home Forums Plugins Product Importer Deluxe Multi Currency Suite import

This topic contains 5 replies, has 2 voices, and was last updated by  Michael Visser 1 year, 11 months ago.

Welcome to our community support forums! We're here to help - but if you have an urgent request for a Pro Plugin, you will get a prioritised response through our Premium Support page.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #46092

    Dima
    Participant

    Hello Michael,
    Our site has “WooCommerce Ultimate Multi Currency Suite” and I am using it in import.
    It gets imported just fine except the “base currency”.
    >>> WooCommerce base currency: ILS
    >>> Skipping Regular Price (ILS) as it is the base currency
    >>> Skipping Sale Price (ILS) as it is the base currency
    We thought about it and this seem to be wrong behaviour:
    1) Our default currency is $ USD.
    2) There is a feature in “Multi Currency Suite” that sets default the currency of the country of the user. Which is actually for frontend to show that user prices in his currency. But somehow PID gets this value and hence skips adding that currency.
    3) SED exports fine, in our case no USD in export as it is in “Price” field.

    IMHO PID just has to import the fields as they are and not check for base currency. Or check base currency some other way to not to be dependent on geolocation.

    Thanks

    #46095

    Michael Visser
    Keymaster

    Hi Dima, from memory WooCommerce Ultimate Multi Currency Suite adds some secret sauce to the _price detail for the base currency. What you need to do is change the default currency from the storefront dropdown to another currency option (preferably one you are not importing) then run the import and it will work. I’ve made a note to revisit this as it was quite confusing the first time I implemented currency import support for that Plugin.

    If I’m on the wrong page please open up a Support ticket and we’ll look at this together 🙂

    https://www.visser.com.au/premium-support/

    #46110

    Dima
    Participant

    Ok so I debugged this myself. I think you can definitely use this info.
    WooCommerce Ultimate Multi Currency Suite(WUMCS) using geolocation in frontend (in our setup, which is one of the options of WUMCS). This is not applied in backend. In backend there is single base currency which is set in WC. Now somehow PID runs as frontend (I think) since “get_woocommerce_currency()” in “product-new.php” line 2097 and on, gets currency by geolocation. WCMCS uses this: “add_filter(‘woocommerce_currency’, array($this, ‘custom_currency’), 9999);”. Now the best solution would be to remove this filter while importing, but since it has “$this” its trickier and has overhead.
    So here is my solution which works:

    add_filter( 'woo_pd_create_product_defaults', 'set_right_base_currency', 10, 2 );
    function set_right_base_currency($defaults, $prod_id){
        add_filter('woocommerce_currency', 'back_my_currency', 99999);
        return $defaults;
    }
    function back_my_currency(){
        $currency = get_option('woocommerce_currency');
        return $currency;
    }

    There is only one small problem with this that you can help with:
    I used “woo_pd_create_product_defaults” hook, but it runs many times during import. Which hook would be better to use to set this up once in beginning of import?

    Thanks

    #46115

    Michael Visser
    Keymaster

    Hi Dima, you’ve been busy! I’ll have a look at whether I have exposed a global import Filter but it may need to run several times as we use the WP-AJAX engine within the WordPress Administration and it may be treating each part of the Product import process (Populate Products or even Populate Product #1) as a separate request which requires those Filters to be re-applied on each new request.

    If you were using the CRON import engine it could be applied globally as it’s a single request. I’ll clear my wall of Support tickets and reproduce this with you then respond here in detail 🙂

    #46190

    Dima
    Participant

    Hey no pressure, this solution gets me by just fine until then))
    Here is a thought: I figure since the import runs each ajax request, then its something that runs all the time and can have that currency info for ajax to pull off of it. Another approach, do you use frontpage ajax or admin ajax? Coz admin ajax might just pull the right currency and no need for any hassle at all. As for CRON – it probably runs as frontend as SED does, so there as you said it could be applied globally. I did not go in that deep into your plugin to know if its right, just thinking out loud 😉

    #47112

    Michael Visser
    Keymaster

    Hi Dima, we use admin-ajax.php when importing via WooCommerce > Product Importer…, the CRON import doesn’t use WP-AJAX instead running the import as a single process. Regarding the above query I’ll need to add a new Filter that is run multiple times so that it can be applied globally; apply it once, it runs throughout the import process.

    I’ve created a Trello card to look further at this and will schedule in time to get this change included in the next Plugin releases.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.