• Resolved demonshi

    (@demonshi)


    How can I show a notification about the minimum order amount in your plugin?

    I am using the code:

    // Set this variable to specify a minimum order value
        $minimum = 1000;
    
        if ( WC()->cart->total < $minimum ) {
    
            if( is_cart() ) {
    
                wc_print_notice( 
                    sprintf( 'Your current order is %s. Minimum Order Amount - %s.' , 
                        wc_price( WC()->cart->total ), 
                        wc_price( $minimum )
                    ), 'error' 
                );
    
            } else {
    
                wc_add_notice( 
                    sprintf( 'Your current order is %s. Minimum Order Amount - %s.' , 
                        wc_price( WC()->cart->total ), 
                        wc_price( $minimum )
                    ), 'error' 
                );
            }
        }

    As I understand it, you need to insert it in /public/templates/parts/cart.php. But when I insert all the code, the cart does not work.

    How can I use this code in your plugin? Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author XplodedThemes

    (@xplodedthemes)

    Hi,

    Try inserting this instead:

    
        // Set this variable to specify a minimum order value
        $minimum = 1000;
    
        if ( WC()->cart->total < $minimum ) {
    
                echo sprintf( 'Your current order is %s. Minimum Order Amount - %s.' , 
                    wc_price( WC()->cart->total ), 
                    wc_price( $minimum )
                );
            );
    
        }
    
    Thread Starter demonshi

    (@demonshi)

    Thanks for the answer!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘The minimum order amount in the cart’ is closed to new replies.