• Hi, i’m using your plugin in order to place a 5% discount for orders paid by credit card. Is there a way to disable it when a specific coupon is applied?

    Thanks in advance

Viewing 1 replies (of 1 total)
  • Plugin Author Karolina Vyskocilova

    (@vyskoczilova)

    Hi! You could use this snippet:

    function my_pay4pay_handle_coupon( $do_apply, $amount, $calculation_base, $current_payment_gateway ) {
    // Define the specific coupon code to check for
    $specific_coupon = 'your_coupon_code'; // Replace 'your_coupon_code' with the actual coupon code you want to check

    // Get the applied coupons
    $applied_coupons = WC()->cart->get_applied_coupons();

    // Check if the specific coupon is applied
    if ( in_array( $specific_coupon, $applied_coupons ) ) {
    return false;
    }

    // Return the original value if the specific coupon is not applied
    return $do_apply;
    }
    add_filter( "woocommerce_pay4pay_apply", 'my_pay4pay_handle_coupon', 10, 4 );

    Cheers!
    Karolina

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.