Minimal order amount with multi currencies
-
Hello!
I want to set the minimum cart amount to order. I have 2 currencies and with this basic currency all works wine but not with custom.
Here is the code I use:add_action( 'woocommerce_checkout_process', 'grib_wc_minimum_order_amount' ); add_action( 'woocommerce_before_cart', 'grib_wc_minimum_order_amount' ); function grib_wc_minimum_order_amount() { $currency = get_woocommerce_currency(); if ($currency == 'GBP'){ $minimum = 20; } else{ $minimum = 800; } if ( WC()->cart->subtotal < $minimum ) { if( is_cart() ) { wc_print_notice( sprintf( 'Минимальная сумма заказа <b>%s</b>. Сумма вашего заказа <b>%s</b>. Добавьте больше ?? <a href="/magazin/">Перейти в каталог</a>' , wc_price( $minimum ), wc_price( WC()->cart->subtotal ) ), 'error' ); } else { wc_add_notice( sprintf( 'Минимальная сумма заказа <b>%s</b>. Сумма вашего заказа <b>%s</b>. Добавьте больше ?? <a href="/magazin/">Перейти в каталог</a>' , wc_price( $minimum ), wc_price( WC()->cart->subtotal ) ), 'error' ); } } }
I think that the second and else currencies doesn’t use the get_woocommerce_currency(); function. So what should I do to make this snippet work with the Multi Currency for WooCommerce?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Minimal order amount with multi currencies’ is closed to new replies.