How to apply a coupon programmatically in WooCommerce?

Posted by Rohit Kumar | Updated on

In this example, I have shared how to apply a coupon programmatically in WooCommerce Use following code in your theme’s functions.php file OR in site specific plugin.

Then apply that coupon to your order:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers