Setup a woocommerce variable pricing on product variations

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

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


1. Create a WooCommerce variable pricing on a product variation with a specific attribute value

In order to create a dynamic WooCommerce variable pricing on product variations, we need to create a product list. A product list is a subset of your shop’s products that you can use in discounts rules or as target when creating a discount. This WooCommerce bulk discount demo will show you how to go about it.

In order to create our list:

  1. Click on Discounts > Products Lists to access the lists management page.
  2. Next click on New List to access the list creation page
  3. Then select Dynamic Request as 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.

2. Create variation attributes

There are two ways to create variation attributes, you can store each way differently on WooCommerce:

2.1. From the menu Products > Attributes

WooCommerce store these as terms. Furthermore 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:

  • Ring Style will be stored as attribute_pa_ring-style which is a combination of attribute_pa and the attribute name’s slug ( in lowercase, the spaces replaced by “-” and the special characters removed).
  • and Gold Rose will be store as gold-rose which is the slug of the term.
  • likewise Silver will be stored as silver.
  • Gold will be stored as gold too.

In this case the metas will be appear as below:

2.2. From the product creation page

WooCommerce stores them directly as meta but slightly differently:

  • Ring Style will be stored as attribute_ring-style which is a combination of attribute_pa and the attribute name’s slug ( in lowercase, the spaces replaced by “-” and the special characters removed).
  • Gold Rose will be stored as gold-rose which is the slug of the term.
  • Silver will be stored as silver.
  • Gold will be stored as gold.

In this case the metas will be appear as below:

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

3. Create a WooCommerce variable pricing on product variations with a specific attribute

For instance you need to create a WooCommerce variable pricing on all variable products with a specific attribute no matter the value,  you can follow the same steps in the demo above but setting up the metas a bit differently as below:

Therefore you’ll need to make sure the key matches the format and it will depend on how you created the variation attributes based on the previous explanations.

This finally completes our tutorial on the creation of WooCommerce variable pricing on product variations based on their attributes using Conditional Discounts for WooCommerce. We hope the WooCommerce bulk discount demo helped you? If you have any questions, use the comments section to ask.

Last updated on May 11, 2023

Contents