Hi,
Thanks for your kind words.
We surely consider to add this option in our next update.
[ Signature moderated ]
No restrict by Coupon in the update today?
Hi,
No. That was a fix update developed days ago, fixing an issue with shipping method calculation.
Nevertheless, I will send you a snippet to add in your functions.php later today, supporting your scenario!
[ Signature moderated ]
Here you are. Add this to your functions.php and adjust the coupon codes.
The code is tested and working.
add_filter( 'wc_smart_cod_available', 'cod_restrict_coupons' );
function cod_restrict_coupons( $is_cod_available ) {
global $woocommerce;
$applied_coupons = $woocommerce->cart->applied_coupons;
// add the coupon codes you want
// to restrict in this array
$restricted_coupons = array(
'awesome coupon',
'coupon 2'
);
if( array_intersect( $restricted_coupons, $applied_coupons ) ) {
$is_cod_available = false;
}
return $is_cod_available;
}
Let me know if any issues.
[ Signature moderated ]
Hi,
Iām waiting for your reply!
[ Signature moderated ]
This is awesome thanks, Stratos.
Still would be even better if you could add to the default plugin.
Just wondering why are you doing all this and such a nice plugin that you can easily sell for free?
Surely it will be part of our next update.
For some projects the contribution is what matters to me.
There is a donation link here anyway, but the positive feedback means a lot as well š
[ Signature moderated ]
It will help us a lot if you rate our effort.
[ Signature moderated ]