PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Product that can only be sold in one currency. Its possibile? HELP ME

This support system is for all types of the plugins as for premium versions, so for free ones! If you have premium version do not forget in the private data of the request (!!not in the text of the support request!!) after its publishing insert purchase code please (see blue-green button on the right side) and press Save button.
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

I need some help. I have a website with two currency: EUR and USD.

I would need a product to be available only in one currency (for example, only in dollars) and not available in the other. It's possible to do it?
Alternatively it might be useful to automatically change the currency when viewing the product and in checkout but only for that product. I saw this on your site:

add_filter('wp_head',function(){    
    if(is_checkout()){
        global $WOOCS;
        $WOOCS->set_currency('USD');
    }
});

It could be useful but it should only work via product ID but the solution of making the product salable only in one currency would be better.

Can you help me?

Hello

Unfortunately, the plugin does not have such a feature, and we do not have a ready-made solution for you.

Possible problems:

It's easy to do on the product page:

add_filter('wp_head',function(){    
    if(is_product('X')){
        global $WOOCS;
        $WOOCS->set_currency('USD');
    }
});
But how is this supposed to work on the store page when multiple products are displayed.(only one currency can be displayed on the page. ) OR  several different products have been added to the cart

In fact it will possibile to buy only one product at time. I found this:

if(is_single( '7051' ) ) {
global $WOOCS;
$WOOCS->set_currency('EUR');
}
});

 

and for checkout this:

 

add_action('woocommerce_after_order_notes', 'conditional_checkout_field');
function conditional_checkout_field( $checkout ) {

// Set here your product IDS (in the array)
$product_ids = array( 6948, 7049, 7052 );
$is_in_cart = false;

// Iterating through cart items and check
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item )
if( in_array( $cart_item['data']->get_id(), $product_ids ) ){
$is_in_cart = true; // We set it to "true"
break; // At east one product, we stop the loop
}

// If condition match we display the field
if( $is_in_cart ){
global $WOOCS;
$WOOCS->set_currency('USD');
}

};

 

It miss a function for cart page... Can you  recommend something?

hello

the code looks good.

Maybe you should change the hook (whichever comes first)