Skip to content
Advertisement

WooCommerce buy one get one 50% off, excluding a product variation

I am using WooCommerce discount: buy one get one 50% off with a notice answer code, if customer purchases a specific product, customer get 50% discount off on the 2nd item.

Now If the targeted product id is a variable product with for example 3 variations “A”, “B” and “C”, how can I exclude for example the variation “A” from discount calculation? Where should put that condition?

Advertisement

Answer

The following will handle variation exclusion from the original answer code:

JavaScript

Code goes in functions.php file of your active child theme (or active theme). Tested and works.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement