How to add Order Limits in WooCommerce
Are you looking for various ways to add order limits in WooCommerce? It can be great for store owners who want to control their order scale and product stock to have a profitable business.
Today, in this guide we’ll learn how to set order limits on a WooCommerce website. Before that let’s have a look at what order limits are and why it is important to add order limits to your online store.
What are Order Limits?
An order limit is a rule to set limitations to minimum and maximum orders of a product based on the order quantity or amount. The order limits can be classified into two types, minimum and maximum order limits.
Minimum order limits are the smallest number of orders that a customer can place depending on the order quantity or amount. For example, to purchase a certain product buyer must at least buy 100 units or pay $100. If the cart is less than 100 units or an amount less than the required minimum, customers will be informed with a message in that case. They are mostly set for wholesale purposes.
On the other hand, you can set maximum order limits so that customers won’t exceed a certain number of orders during the purchase. This helps you to sell the product that has a high-profit margin and control the inventory of your store. This can also prevent customers to order in large bulks and help you manage the product’s stock in a better way.
Why add Order Limits in WooCommerce?
Running an online business comes with expenses for shipping, warehouse storage, and other additional fees. And small orders mean more shipping costs. Therefore setting minimum order limits for each WooCommerce product guarantee that every order is profitable. Setting up minimum order limits of quantity or amount allows customers to add extra products to the cart in order to checkout.
On the other hand, altering the WooCommerce store’s default product quantity encourages customers to make larger purchases. But there is a high chance that they might order more if you don’t add maximum order limits.
Setting up maximum order limits ensures that your customers only make purchases that are limited to a certain quantity or sum. Due to this, you can also get a good hold of orders that are too large for you to handle. In this way, adding both maximum and minimum order limits helps you to control the quantity of the products in your WooCommerce store.
How to add Order Limits in WooCommerce?
There are a number of ways through which you can add order limits in WooCommerce. However, the following two major methods are the most effective ways to do so:
- Using a plugin
- Programmatically
We will show you both the methods in detail in this tutorial. So you can choose the one that is the most convenient for you and meets the requirement for your online store.
1. Add Order Limits in WooCommerce using a Plugin
In this section, we’ll show you how to use a WordPress plugin to add order limits in WooCommerce. If you check the internet for the best WordPress min/max order plugins, you will land on multiple free, freemium, and premium options.
But for this tutorial, we will be using the free plugin Order Limit for WooCommerce. It is a freemium plugin that consists of all the basic features to add order limits in WooCommerce. The plugin even allows you to add the maximum and minimum limits for products, product categories, vendors, and total cart value.
As with all the plugins, you need to install and activate the plugin to start using it.
1.1. Install and Activate Order Limit for the WooCommerce
So the very first thing is to log in to your WordPress backend and visit the ‘Add New’ from the ‘Plugins‘ section. There, search for the keyword ‘Order Limit for WooCommerce‘.
Once the results are displayed and you find the plugin, click on the ‘Install Now’ button. The installation will be completed shortly. After the plugin is installed, you need to Activate the plugin.
As soon as you activate the plugin, you’ll find the plugin’s settings inside the ‘WooCommerce’ menu of your WordPress dashboard.
From here, you can either set the order limit for all products or set the order limit for just a specific product. First, let’s see how we can add order limits to all WooCommerce products on our website.
1.2 Add Order Limits to all Products
To add the order limits to all products, navigate to WooCommerce > Order Limit Lite for WooCommerce from your WordPress dashboard first.
As it directs you to the Order Limit Lite page, you can find various tabs along with advanced options. Simply click on the ‘Products’ tab.
Now, click on the Add New Rule button. A box will appear just below the products tab, which will allow you to select a single product or all products. Select the ‘All Products’ option since we are limiting orders for all products.
Then you can either set the order limit by the amount or the quantity.
Here, we have selected the order limit by quantity and set the minimum order limit by 10. To set the maximum order limit, click on the ‘More Options’ link.
You can find additional options for maximum limit here. The options allow you to enable as well as disable the order limit. As soon as you check the checkbox to Enable Maximum Limit, a new field will pop up where you can set the maximum order limit.
In our case, we have set the maximum limit to 100. Then, click on the ‘Save’ button.
To check if the settings worked or not, click on any of your products and set the quantity above the maximum or below the minimum limit. If your customers have a set quantity of more than the maximum limit, or less than the minimum limit, they’ll be notified with a message similar to the image below.
Similarly, you can also add an order limit to a certain category. All you have to do is click on the ‘Categories’ tab and the rest of the other steps are the same as above.
These were the steps to add order limits to all WooCommerce products. Now let’s see how we can add order limits to specific products.
1.3 Add Order Limits to Specific Products
You can either add order limits to specific products from the ‘Order Limit Lite Page’ or the ‘Edit product page’. If you want to add order limits to specific products from the plugin page, just select the product name from the dropdown menu. The rest of the other method is the same as the previous method.
Or else you can go to Products > All Products and Edit the specific product.
This leads you to the product edit page. As you scroll further, you’ll find a newly added “Order Limit Lite for WooCommerce” option within the product data settings.
Here, you can find 3 options. They allow you to set minimum order limits and enable maximum limits. You can even select to apply the limit on either quantity or amount. Add the desired input on these fields and make sure to click on the Update button.
Once again, try adding the particular product for order on your cart page from your front end. The minimum and maximum limits will be displayed to you if the order quantity exceeds them or is fewer.
2. Add Order Limits Programmatically in WooCommerce
If you don’t want to install a plugin to add the order limit in your WooCommerce store, you can also go for the programmatic approach. But you will need some basic coding skills for this method as it requires you to edit the core part of your theme.
So before we continue, we strongly advise you to make a complete backup of your site and always use a child theme. If you want to create a child theme you can take a look at this article. Instead of manually creating a child theme you can also use one of the child theme plugins.
2.1. Open Theme Functions File
We will add a custom code in your functions.php file. For that go to Appearance > Theme File Editor in your WP-Admin Dashboard.
You can now add your custom code snippets at the end of the ‘functions.php’.
2.2. Add Code Snippet to the Theme Functions File
Once you open the file editor, just add the following code here. For now, it allows you to add an order limit to your WooCommerce store based on the minimum amount of the cart. But you can easily replace the amount with the amount you want to set for your order limit.
add_action( 'woocommerce_check_cart_items', 'required_min_cart_subtotal_amount' ); function required_min_cart_subtotal_amount() { // HERE Set minimum cart total amount $minimum_amount = 300; // Total (before taxes and shipping charges) $cart_subtotal = WC()->cart->subtotal; // Add an error notice is cart total is less than the minimum required if( $cart_subtotal < $minimum_amount ) { // Display an error message wc_add_notice( '<strong>' . sprintf( __("A minimum total purchase amount of %s is required to checkout."), wc_price($minimum_amount) ) . '<strong>', 'error' ); } }
To make the changes take effect, click the Update File button once you’ve finished.
Then, go to your store and add a product once again. As you can see, customers cannot checkout until and unless they make a purchase of at least $300.
Bonus: How to Test WooCommerce Orders
We have shown you how easy it is to add order limits in WooCommerce by using a plugin or adding a simple code. Limiting the orders helps the seller to control the price and quantity on the other hand buyer gets a good deal out of it. It is very important to ensure that every process of purchase runs smoothly mainly the checkout, especially for huge sales.
That’s why it is very essential to perform a test with payment gateway and methods. This will make sure that every purchase on your online store is carried out without any issues. So in this section, we’ll show you how you to test WooCommerce orders with a few simple steps.
1. Enable Payment Method to Test Orders
One of the easiest ways to create test orders doesn’t require any third-party plugins and can be done directly from the WooCommerce dashboard. All you have to do is enable cheques as a mode of payment.
Cheques are typically used as a cash substitute that’s why enabling the cheque option means there won’t be any online transactions.
To enable the cheque option go to WooCommerce > Settings in your WordPress dashboard and select the ‘Payments’ tab. And then enable the toggle for payment.
You can also make further changes to the particular payment method by clicking on Set up or Manage.
Once you have made all the necessary changes to it, click on Save changes.
2. Test WooCommerce Order
After that, go to the front end of your store, add a product to the cart, and then click through to the checkout page. Enter the necessary billing information and select “Check payments” as your method of payment. Then, click “Place Order” for confirmation.
Next, you’ll be redirected to the order you just placed. Since this process doesn’t include any online transactions you can verify your order with the details that you’ll receive. If the details are correct, both you and your customers won’t have any issues with the orders and transactions.
That’s it! This is a very quick way to test the WooCommerce order to ensure a smooth checkout.
However, there are other solutions if the cheque is not the payment gateway you want to choose for your website. You can use dedicated plugins and enable other test modes. We recommend you check out this comprehensive guide where you can find other different methods to test WooCommerce orders.
Conclusion
This is how you can add order limits on your WooCommerce website. They can be very useful for you if you sell as a wholesale vendor. It helps you to control the quantity of the products and prevent users from buying more than the limit you set.
To summarize, we had a look at 2 ways to add order limits in this tutorial. They are:
- Programmatically
- Using a plugin
The easiest and quickest approach to adding order limits is by adding a custom code snippet. However, you can only set the order limits by amount. While on the other hand, you can set the order limit by quantity as well as the amount with a plugin.
Not only that, Order Limit in WooCommerce plugin allows you to set limits based on products, categories, and vendors. You can even customize the message directly from the dashboard.
So can you set the order limits on your online store now? Let us know in the comment section which method works best for you.
Meanwhile, if you want to learn more about WooCommerce, check out these blogs: