Title: Minimum Spend Amount
Last modified: October 9, 2021

---

# Minimum Spend Amount

 *  Resolved [Warren](https://wordpress.org/support/users/rabbitwordpress/)
 * (@rabbitwordpress)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/minimum-spend-amount/)
 * Hi There,
 * We’re using [this filter](https://docs.woocommerce.com/document/minimum-order-amount/)
   to restrict checkout to a minimum order amount.
 * However users are able to bypass this by using the **PayPal Express Checkout 
   Button** at the basket.
 * Is there a way to set a minimum order in your plugin, in PayPal or even a way
   to hide the **Check out with PayPal** button until the minimum order amount is
   reached?
 * Many thanks
    Warren
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fminimum-spend-amount%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/minimum-spend-amount/#post-14957915)
 * Hi @rabbitwordpres,
 * Please try replacing the snippet with the below-updated snippet in which we have
   added our plugin filter. You can get the updated snippet from [here. ](https://gist.github.com/webtoffee-git/47b8245a5d45b2be4512c621e00c8260)
 *  Thread Starter [Warren](https://wordpress.org/support/users/rabbitwordpress/)
 * (@rabbitwordpress)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/minimum-spend-amount/#post-14958162)
 * Hi [@webtoffee](https://wordpress.org/support/users/webtoffee/)
 * Yes that worked perfectly, thank you so much. Great support as always!
 * Just wondering if there is a way to hide the **Proceed to checkout** button too?
 * Many thanks
    Warren
    -  This reply was modified 4 years, 8 months ago by [Warren](https://wordpress.org/support/users/rabbitwordpress/).
 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/minimum-spend-amount/#post-14961017)
 * Hi [@rabbitwordpress](https://wordpress.org/support/users/rabbitwordpress/),
 * We have developed a code snippet for this requirement. Please try using the code
   [here.](https://gist.github.com/webtoffee-git/26997518f2043445dc6071ec718ff9f0)
 *  Thread Starter [Warren](https://wordpress.org/support/users/rabbitwordpress/)
 * (@rabbitwordpress)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/minimum-spend-amount/#post-14961045)
 * Hi [@webtoffee](https://wordpress.org/support/users/webtoffee/)
 * Okay great thank you very much, I was still able to use Stripe.
 * So I used your code from yesterday along with the code I already had to prevent
   users from getting past the basket page, please see below:
 *     ```
       // Minimum Spend £24 for Nick
   
       add_action( 'woocommerce_check_cart_items', 'required_min_cart_subtotal_amount' );
       function required_min_cart_subtotal_amount() {
           // Only run in the Cart or Checkout pages
          if( is_cart() || is_checkout() ) {
   
               // HERE Set minimum cart total amount
              $min_total = 24;
   
               // Total (before taxes and shipping charges)
              $total = WC()->cart->subtotal;
   
               // Add an error notice is cart total is less than the minimum required
              if( $total <= $min_total  ) {
                   // Display an error message
                  wc_add_notice( '<strong>' . sprintf( __("A minimum total purchase amount of %s is required to checkout."), wc_price($min_total) ) . '<strong>', 'error' );
              }
          }
       }
   
       /**
        * Set a minimum order amount for checkout
        */
       add_action( 'woocommerce_before_checkout_form', 'wc_minimum_order_amount' );
       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 = 24;
   
           if ( WC()->cart->total < $minimum ) {
   
       		add_filter( 'wt_show_paypal_express_button_in_cart_page', 'wt_show_paypal_express_button_in_cart_page', 99 );
       		add_filter( 'wt_show_paypal_express_button_in_checkout_page', 'wt_show_paypal_express_button_in_checkout_page', 99 );
               if( is_cart() ) {
   
                   wc_print_notice(
                       sprintf( 'Your current order total is only %s.' ,
                           wc_price( WC()->cart->total ),
                           wc_price( $minimum )
                       ), 'error'
                   );
   
               } else {
   
                   wc_add_notice(
                       sprintf( 'Your current order total is only %s.' ,
                           wc_price( WC()->cart->total ),
                           wc_price( $minimum )
                       ), 'error'
                   );
   
               }
           }
       }
   
       function wt_show_paypal_express_button_in_cart_page($show){
       	$show = false;
       	return $show;
   
       }
       function wt_show_paypal_express_button_in_checkout_page($show){
       	$show = false;
       	return $show;
   
       }
       ```
   
 * Please go ahead and close this ticket now and mark as resolved.
 * Thanks again for your help!
    Best regards Warren
 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/minimum-spend-amount/#post-14964997)
 * Hi [@rabbitwordpress](https://wordpress.org/support/users/rabbitwordpress/),
 * If you are happy with our plugin and support please [leave us a review here](https://wordpress.org/support/plugin/express-checkout-paypal-payment-gateway-for-woocommerce/reviews/#new-post).
 *  Thread Starter [Warren](https://wordpress.org/support/users/rabbitwordpress/)
 * (@rabbitwordpress)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/minimum-spend-amount/#post-14965165)
 * Hi [@webtoffee](https://wordpress.org/support/users/webtoffee/) all done mate,
   hows that?
 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/minimum-spend-amount/#post-14968526)
 * Hi [@rabbitwordpress](https://wordpress.org/support/users/rabbitwordpress/),
 * Thank you so much for taking the time to leave us a 5-star review.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Minimum Spend Amount’ is closed to new replies.

 * ![](https://ps.w.org/express-checkout-paypal-payment-gateway-for-woocommerce/
   assets/icon-256x256.gif?rev=3385064)
 * [Payment Gateway of PayPal for WooCommerce](https://wordpress.org/plugins/express-checkout-paypal-payment-gateway-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/express-checkout-paypal-payment-gateway-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/express-checkout-paypal-payment-gateway-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/express-checkout-paypal-payment-gateway-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/express-checkout-paypal-payment-gateway-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/express-checkout-paypal-payment-gateway-for-woocommerce/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/minimum-spend-amount/#post-14968526)
 * Status: resolved