Skip to content

Instantly share code, notes, and snippets.

@smeric
smeric / woocommerce-add-to-cart-before-applying-coupon.php
Last active July 23, 2018 09:16
Made to be used with the "Smart Coupons" WooCommerce extention. If we apply coupon from url and the coupon is dedicated to a specific product, the coupon is not applied if the product is not already in cart. So, before applying the coupon we add this product to cart.
<?php
/**
* Add to cart before applying coupon
*
* Made to be used with the "Smart Coupons" WooCommerce extention.
* If we apply coupon from url and the coupon is dedicated to a specific product, the coupon is not applied if
* the product is not already in cart. So, before applying the coupon we add this product to cart.
*
* @link
* @version 1.0.1