How can i set a limit order ?

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 1 reply thread
  • Author
    Posts
    • #107139
      georgeanna
      Participant

      Hello,
      Is there any way how can i set a limit on the order amount.
      Example i want orders to be made when they have a value 50 euros or more (<=50 euro).
      Thank you.

    • #107606

      Hello,

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      /**
       * Set a minimum order amount for checkout
       */
      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 = 50;
      
          if ( WC()->cart->total < $minimum ) {
      
              if( is_cart() ) {
      
                  wc_print_notice( 
                      sprintf( 'Your current order total is %s — you must have an order with a minimum of %s to place your order ' , 
                          wc_price( WC()->cart->total ), 
                          wc_price( $minimum )
                      ), 'error' 
                  );
      
              } else {
      
                  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( WC()->cart->total ), 
                          wc_price( $minimum )
                      ), 'error' 
                  );
      
              }
          }
      }

      Ref. link: https://docs.woocommerce.com/document/minimum-order-amount/

      Thanks.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.