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

checkout billing and shipping

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
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.

hello dear, Trying to fix issue with checkout. Problem is:

I want to have first Billing Address with Shipping Address with checkout geo functions. When customer come to checkout and order for him and choose his billing country Serbia, his price will be in RSD. But if he come to order for someone else for example someone in Germany, price will stay in RSD because : $_currency = $WOOCS->get_currency_by_country($data['billing_country']); ............ Reason why i can't let stay to shipping_country is because i use Stripe payments, and they prefer and allow billing address because frauds.
https://pastebin.com/FiR372eG. ( this code i use now for security reasons , but i don't want customer to type 2 address (billing,shipping) and they need only one like billing, if customer buying for himself)
Need help with: If customer use only billing address (buying for himself) ($data['billing_country']) this code will work alone, if he click checkbox for additional shipping address: than another your function will change to ($data['shipping_country']) .
I hope you understand. Thanks,Boris

Hello Boris

Try  to use  this  code

add_action('woocommerce_checkout_update_order_review', function($data) {
global $WOOCS;

if (is_string($data)) {
parse_str($data, $data);
}
//***
$country = $data['billing_country'];
if(isset($data['shipping_country']) AND $data['shipping_country']){
$country = $data['shipping_country'];
}
$_currency = $WOOCS->get_currency_by_country($country);
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}
}, 9999);

Hi, thanks for code.

Code works but have minor problem. After ship to another address is checked, price will collect only shipping address and if after that unchecked price will collect shipping not anymore. (if customer click by mistake that button and uncheck, prices will be calculate by that unfinished form of another address) I upload video.

https://easyupload.io/huup9m

Hello

Ok!  Try  this  code:

 

add_action('woocommerce_checkout_update_order_review', function($data) {
global $WOOCS;

if (is_string($data)) {
parse_str($data, $data);
}
//***
$country = $data['billing_country'];
if(isset($data['shipping_country']) AND $data['shipping_country'] AND !wc_ship_to_billing_address_only()){
$country = $data['shipping_country'];
}
$_currency = $WOOCS->get_currency_by_country($country);
if (!empty($_currency)) {
$WOOCS->set_currency($_currency);
}
}, 9999);