Okay
  Public Ticket #1273611
minimum order limit
Closed

Comments

  •  2
    isomri started the conversation

    hi there,

    because you dont have settings for limit order i need to use a code so please help with that.

    so.. i insert a limit order code, but you can see in the screenshot the code calculate the minimum order without the coupon code that i insert there.

    for example, i want 99.90 NIS minimum order in my shop, customer want to buy a coconut oil  and he insert 35% discount coupon so the final cost is 49.90 NIS but the calculator calculate it without the coupon code and its stay on 76.90 NIS.

    p.s that is important to calculate the final cost without the shipping rate but with the coupon code.

    thanks.

    this is my code:

    add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
    add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
     
    function wc_minimum_order_amount() {
        // Set this variable to specify a minimum order value
        $minimum = 99.90;

        if ( WC()->cart->subtotal < $minimum ) {

            if( is_cart() ) {

                wc_print_notice( 
                    sprintf( 'הזמנת מינימום עומדת על סך %s, עגלת הקניות שלך עומדת על סך %s.' , 
                        wc_price( $minimum ), 
                        wc_price( WC()->cart->subtotal )
                    ), 'error' 
                );

            } else {

                wc_add_notice( 
                    sprintf( 'הזמנת מינימום עומדת על סך %s, עגלת הקניות שלך עומדת על סך %s.' , 
                        wc_price( $minimum ), 
                        wc_price( WC()->cart->subtotal )
                    ), 'error' 
                );

            }
        }

    }


  • [deleted] replied

    Hi isomri,

    I understand your case, however this functionality is handled by WooCommerce and I am not sure how you can achieve that.

    I suggest you to address this question in WooCommerce forums and they may help you with proper piece of code.