Do not allow coupons when redeeming a gift card
You can prevent any coupon from being used if there is a Gift Card applied to the cart by taking the following steps:
1. Download the free Code Snippets plugin: https://wordpress.org/plugins/code-snippets/
2. Create a Snippet with the following code (Note: If you are more comfortable with editing your functions.php you can do that instead of Code Snippets.):
function pw_gift_card_prevent_coupons( $is_valid, $coupon ) { $gift_cards_applied = false; if ( defined( 'PWGC_SESSION_KEY' ) ) { $session_data = (array) WC()->session->get( PWGC_SESSION_KEY ); if ( isset( $session_data['gift_cards'] ) && count( $session_data['gift_cards'] ) > 0 ) { $gift_cards_applied = true; } } if ( $gift_cards_applied ) { // Do not allow any coupon if there is a gift card applied. $is_valid = false; } return $is_valid; } add_filter( 'woocommerce_coupon_is_valid_for_cart', 'pw_gift_card_prevent_coupons', 10, 2 ); add_filter( 'woocommerce_coupon_is_valid_for_product', 'pw_gift_card_prevent_coupons', 10, 2 );