• Resolved shreyans94

    (@shreyans94)


    Hey,

    Great plugin..

    Would you be able to add an option to restrict a coupon on COD.

    This would be useful if you want to promote prepaid methods by offering more discount on that.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author FullStack-ing

    (@fullstackhouse)

    Hi,
    Thanks for your kind words.
    We surely consider to add this option in our next update.

    [ Signature moderated ]

    Thread Starter shreyans94

    (@shreyans94)

    No restrict by Coupon in the update today?

    Plugin Author FullStack-ing

    (@fullstackhouse)

    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 ]

    Plugin Author FullStack-ing

    (@fullstackhouse)

    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 ]

    Plugin Author FullStack-ing

    (@fullstackhouse)

    Hi,
    I’m waiting for your reply!

    [ Signature moderated ]

    Thread Starter shreyans94

    (@shreyans94)

    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?

    Plugin Author FullStack-ing

    (@fullstackhouse)

    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 ]

    Plugin Author FullStack-ing

    (@fullstackhouse)

    It will help us a lot if you rate our effort.

    [ Signature moderated ]

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Feature Request’ is closed to new replies.