product variations tutorials
Posted at 

September 12, 2017

 | 
By 

Bellarmin

 | 
In 

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 WooCommerce All Discounts.

How to 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.

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

a) 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:

woocommerce discount product variation attribute

b) Also 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:

 

woocommerce discount product variation attribute

 

  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.

How to 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:

 

woocommerce variable pricing

 

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 WooCommerce All Discounts. We hope the woocommerce bulk discount demo helped you? If you have any questions, use the comments section to ask.

Leave a comment

Your email address will not be published. Required fields are marked *