Site icon Orion Origin

How to create a WooCommerce discount on a product variation?

Variable products are a product type in WooCommerce that lets you offer a set of variations on a product, with control over prices, stock, image, and more for each variation. For various reasons, you may need to dynamically apply a discount on specific variations depending on their attributes.

In today’s article, you will learn how to create a discount on all product variations based on their attributes in a few clicks using Conditional Discounts for WooCommerce.

How to create a discount on a product variation with a specific attribute value?

In order to create a dynamic discount on product variations, we need to create a product list. A product list is a subset of your shop’s products that can be used in discount rules or as a target when creating a discount.

In order to create our list:

  1. Click on Discounts > Products Lists to access the lists management page.
  2. Click on New List to access the list creation page
  3. Select Dynamic Request as the Extraction type
  4. Scroll down to the metas section and let’s create a dynamic request based on the variation attributes that will allow us to get the variations we need.

There are two ways to create variation attributes, each way being stored differently by Woocommerce:

a- From the menu Products > Attributes

WooCommerce stores these as terms. Assuming our variable name is “Ring Style” and that their values are “Gold Rose”, “Silver” and “Gold”, WooCommerce will store them in the database as metas:

In this case, the metas will be defined as below:

b- From the product creation page

WooCommerce stores them directly as meta but slightly differently:

In this case the metas will be defined as below:

  1. Click on the Evaluate button to confirm that the plugin is able to fetch the variations properly.
  2. Click on the Publish button to save your list.
  3. Now that you’ve created your list, you can use it in the discounts. Click on Discounts > New discount to create your discount and use the list we just created.

How to create a discount on all product variations with a specific attribute?

In case you need to create a discount on all variable products with a specific attribute no matter the value, you can follow the same steps but set up the metas a bit differently as below:

Of course, you’ll need to make sure the key matches the format depending on how the variation attributes were created as previously explained.

This completes our tutorial on the creation of discounts on product variations based on their attributes using Conditional Discounts for WooCommerce.

 If you have any questions, Kindly drop them in the comment section 🙂

Exit mobile version