Advertisement
  1. Code
  2. WordPress
Code

WooCommerce for Beginners: Adding Coupons—Usage Restriction Part 3

This post is part of a series called The Beginners Guide to WooCommerce.
WooCommerce for Beginners: Adding Coupons—Usage Restriction Part 2
The Beginners Guide to WooCommerce: Adding Coupons Usage Limits

In the previous article I covered the settings of the Products and Exclude products options, which online store owners find at the time of creating a coupon in WooCommerce. These settings reside in the Usage Restriction section/tab, where the last three options are Product categories, Exclude categories, and Email restrictions. These three options are what we going to configure today. 

Usage Restriction

To enter this part of the plugin go to: WooCommerce > Coupon > Add Coupon > Coupon Data > Usage Restriction

Usage Restriction options

I have already explained the configuration of the following options in my previous articles:

  • Minimum spend
  • Individual use only
  • Exclude sale items
  • Products 
  • Exclude products 

So, if you missed any of those, explore the previous article of this series. Now, let's look at the remaining options which are displayed in the above figure.

Product categories

Product categories option

The option of Product categories allows you to enter the names of all categories where items should be a part of the cart for a customer to get a discount through a coupon.

This means that a customer will only be able to apply the coupon if the cart contains items which belong to the categories you've selected here. To understand how it works, let's consider a coupon with the following settings:

Product categories of Hoodies Posters and Singles
  • Coupon code: free
  • Discount type: Cart Discount
  • Coupon amount: 50
  • Minimum spend: 50
  • Product categories: Hoodies, Posters, Singles

The above data shows that the store owner has entered the categories of Hoodies, Posters and Singles in this field.

Case 1: Cart Items Belong to Product Categories

Cart showing four products

In case 1, a customer visits the store and places various items in the cart:

  1. Happy Ninja: Belongs to the category of Hoodies.
  2. Woo Ninja: Belongs to the category of T-shirts.
  3. Woo Logo: Belongs to the category of Posters.
  4. Woo Album #1: Belongs to the category of Albums.

The first and third cart items belong to the categories which the store owner had specified in the Product categories field. Hence, the customer can enjoy the coupon's discount here.

Cart totals showing discount applied

The cart totals show that once the customer applies this coupon, the original price of the order is reduced to £29.00 from £79.00. 

Case 2: Cart Items Do Not Belong to Product Categories

Four products in shopping cart

In the second case, let's take another example of a cart which contains four different products:

  1. Woo Ninja: Belongs to the category of T-shirts.
  2. Woo Album #1: Belongs to the category of Albums.
  3. Ship Your Idea: Belongs to the category of T-shirts.
  4. Woo Album #4: Belongs to the category of Albums.

These items do not belong to any product category which was selected by the store owner in the Product categories option.

Error message in cart

So an error message is displayed, which notifies the customer that he or she cannot use this coupon for these products.

Cart totals showing no discount applied

The cart totals also represent that no discount is offered and the customer will pay the complete amount, i.e. £58.00.

Exclude categories

Exclude categories option

Exclude categories will function in the opposite manner to the previous settings of Product categories. This option makes sure that the products which are in the cart should not belong to any of the categories which the store owner has mentioned in this field. If such a situation exists, the coupon will not be applied. 

Let's say there are a few premium products which you don't want anyone to buy with any possible discount, so you create a new category and put its name here in the Exclude categories option.

Let's take an explicit example.

Exclude categories field with Albums and Music inside
  • Coupon code: free
  • Discount type: Cart Discount
  • Coupon amount: 50
  • Minimum spend: 50
  • Exclude categories: Albums, Music

The above data shows that the store owner has entered the categories of Albums and Music in this field. If any item from these categories is present in the cart, no discounts can be applied through the above coupon code.

Case 1: Cart Items Belong to Excluded Categories

Cart showing three items

In case 1, consider a cart where a customer has placed following items:

  1. Woo Album #1: Belongs to the category of Albums.
  2. Happy Ninja: Belongs to the category of Hoodies.
  3. Ship Your Idea: Belongs to the category of T-shirts.

The first cart item belongs to a category which the store owner had listed in the Exclude categories field. Hence, a coupon cannot be applied in this case.

Cart showing error message

The above figure shows an error message being generated due to the obvious reason.

Cart totals showing no discounts

The cart totals display no discounts. The total of £64.00 remains the same, which shows that the coupon is invalid for such an order.

Case 2: Cart Items Do Not Belong to Exclude Categories

Cart showing just two items

Now from the same cart let's remove Woo Album #1, leaving behind Ship Your Idea and Happy Ninja in the order. This time when a customer applies the coupon, he or she enjoys a discount of £50.00.

Cart totals showing discount applied

The discounted price for the entire order will now be reduced to £5.00.

Email restrictions

Email restrictions option

The function of this option is pretty much self-explanatory. In Email restrictions you can add a list of comma-separated email IDs which are allowed to use this coupon. This option is cross-checked against the customer’s billing email ID.

Conclusion

We are done with the configuration of Usage Restriction. I hope that you enjoyed configuring this part of the plugin. WooCommerce really makes it easy to use coupons, with so many ways to manage them.

In the next article I will discuss the settings you can find in Usage Limits, which is the last tab/section of Coupon Data. Till then if you have any queries let me know.

Advertisement
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.