I am trying to restrict discounts or coupons if a customer selects a specific payment method. To do this, I have used a plugin called WooCommerce Extended Coupon Features.
I have 3 active payment methods: Cheque, Credit Card & PayPal in respective order. I set a coupon to restrict the discount being applied on the order if the payment method "PayPal" is selected.
However, at the Cart Page when I am adding a coupon to my order, I am getting the current error.
The coupon is not valid for the currently selected payment method.
I thought the default payment method for WooCommerce was to be the first one in sequential order yet it gives me that error. There are ways to programmatically un-apply the default payment method but I have not seen a method to apply it on the Cart page which is before the Checkout page.
I have tried the following:
$available_gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
$available_gateways['cheque']->chosen = true;
But that only works for the Checkout page.
Any ideas?