If you want to set a minimum order amount in Woocommerce, there is a simple fix that can be added to functions.php in your website theme.
function w321_set_minimum_order_amount() { // Set the minimum order amount $minimum = 30; // Get the Cart's total $cart_total = WC()->cart->total; // If the Cart's total is less than the minimum amount, display an error if ($cart_total < $minimum) { wc_add_notice( sprintf('Your current order total is %s — you must have an order with a minimum of %s to place your order.', wc_price($cart_total), wc_price($minimum) ), 'error' ); }}add_action('woocommerce_check_cart_items', 'w321_set_minimum_order_amount');
Here’s a step-by-step guide to implement this:
functions.php file: If you are using a child theme, you can add the code to your child theme’s functions.php file. This ensures that your changes aren’t overwritten when the parent theme updates.$minimum value in the code.Remember that while this method sets a minimum transaction amount, there may be additional configurations or plugins on your WooCommerce site that could conflict with this. Always test thoroughly after making changes.