Home › Forums › Plugins › Product Importer Deluxe › Multi Currency Suite import › Reply To: Multi Currency Suite import
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