Advertisement
  1. Code
  2. WordPress
Code

WooCommerce for Beginners: Adding Coupons—Usage Restriction Part 2

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

In my previous article I discussed the configuration of the first three options in the section of Usage Restriction for coupons in WooCommerce, i.e. "Minimum spend", "Individual use only" and "Exclude sale items". These options allow online store owners to include some additional functionalities and checks in the coupons. However, this section includes several other settings, which are "Products" and "Exclude Products". Let's discuss these options today.    

Usage Restriction

Before starting off with the topic formally, allow me a brief recap of where we are. Go to your website's WordPress admin dashboard and then WooCommerce > Coupons > Add Coupon > Coupon Data > Usage Restriction. Now let's start with the configurations ahead.

Products 

Products option

Products is the option from where I will start today's topic. You can find this option beneath the checkbox of Exclude sale items. The option for Products will work only if you list a number of products which should be in the customer's cart for a coupon to be valid. Simply add the names of the products in the field provided. Let me explain how this setting works with the help of an example.

Products field with three items in it

Consider a coupon with the following settings:

  • Coupon code: free
  • Discount type: Cart Discount
  • Coupon amount: 50
  • Minimum spend: 50
  • Products: Woo Ninja, Woo Logo, Woo Album #1  

The above mentioned data shows that if the customer's cart contains any of these three products (i.e. Woo Ninja, Woo Logo, Woo Album #1) then this coupon can be used. 

Case 1: Cart Contains Product Items 

Cart containing three products

In the first case, the customer's cart contains three different items (i.e. Woo Ninja, Patient Ninja, Woo Album #2) out of which one item (i.e. Woo Ninja) has been defined by the store owner in the Products field of the coupon. It means that the customer can successfully use this coupon and enjoy a discount of £50 on the entire cart. 

Cart total showing 50 pounds discount

The cart totals also show that after using this coupon the original price of the order, i.e. £79, is reduced to £29.

Case 2: Cart Does Not Contain Product Items 

cart showing error message about coupon not applicable

Now the customer's cart contains two different items (i.e. Patient Ninja, Woo Album #2) and no such item has been defined by the store owner in the Products field. Hence, when the customer tries to apply a coupon on the order, a notification will display on the screen with a message saying "Sorry, this coupon is not applicable to your cart contents". 

The cart totals also show that the customer must pay the full amount in this case.

Exclude products

Exclude products field

The option for Exclude products will function in the opposite manner to Products which we've just discussed. In this field you can specify the names of all those products on which the coupon will not apply, and if any of these products are in the cart then a customer will not be able to use this coupon. I am again going to explain the working of this coupon, which has the following configurations:

  • Coupon code: free
  • Discount type: Cart Discount
  • Coupon amount: 50
  • Minimum spend: 50
  • Exclude products: Woo Logo, Woo Album #2, Woo Single #2  
Exclude products field containing three items

If the customer's cart contains any of these three products (i.e. Woo Logo, Woo Album #2 and Woo Single #2) then this coupon cannot be used. 

Case 1: Cart Contains Exclude Products Items 

Cart showing error message

The figure displayed above shows a cart where a customer has placed three different items, i.e. Woo Album #2, Happy Ninja and Woo Ninja. However, the online store owner has added Woo Album #2 in the Exclude products field. So when the customer tries to use the coupon on this cart, a notification of an unsuccessful attempt will be displayed.

Cart totals showing full price charged

And similarly, the cart totals also represent a full price of £59 which is to be paid by the customer.  

Case 2: Cart Does Not Contain Exclude Products Items 

Coupon code applied successfully

In the next scenario, the cart again contains three different items (i.e. Happy Ninja, Woo Ninja, Woo Single #1), but this time no item from the Exclude products field is included. So the coupon will be applied successfully, as can be seen below.

Cart showing 50 pounds discount

The cart totals shows that now a customer enjoys a discount on the total price of £53, which reduces to £3.

I hope to have explained these two properties clearly, with two different examples each. I will be completing the section of Usage Restriction settings in my next article. I hope that up till now I have made things quite clear. Still if you have any queries you may ask in the comment box below.  

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.