Skip to content
Advertisement

Exclude product from all coupons in WooCommerce

I have searched all over the internet, but it doesn’t seem to be any answer anywhere in spite of countless people asking the question.

Is there any way to exclude a specific product from ALL coupons?

I understand that you can do it on coupon level, but this is rather messy especially as a lot of people have automatic coupons, several people creating coupons etc…

TLDR: Any way to make a product excluded from all coupons at Product level.

Advertisement

Answer

Here is a nice way to automate this process.

1) We add a custom checkbox in product general settings metabox to disable the coupon functionality for the current product. So you will get this in Backend Edit Product pages:

custom checkbox in product general settings metabox

All selected products will be saved in an array and will be used in the following…

2) This selected products will be excluded from coupon discount at product level and the product discount amount will be set to zero.


The code:

JavaScript

Code goes in function.php file of your active child theme (or active theme) or in any plugin file.

Tested and perfectly works

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