Skip to content
Pimwick®

PIMWICK DOCUMENTATION

Limit the number of gift cards that can be redeemed per order

1. Download the free Code Snippets plugin: https://wordpress.org/plugins/code-snippets/
2. Create a new Snippet with the following code:

function custom_pwgc_git_card_can_be_redeemed( $message, $gift_card ) {
    $session_data = (array) WC()->session->get( PWGC_SESSION_KEY );
    if ( isset( $session_data['gift_cards'] ) && count( $session_data['gift_cards'] ) >= 1 ) {
        $message = 'Only one gift card can be redeemed per order.';
    }

    return $message;
}
add_filter( 'pwgc_gift_card_can_be_redeemed', 'custom_pwgc_git_card_can_be_redeemed', 10, 2 );

Change the “1” above to the limit you want to enforce.

You can also remove the Gift Card input field from the Cart and Checkout pages by going to Pimwick Plugins -> PW Gift Cards -> Settings -> Redeem Location.

A HUMAN ON THE OTHER SIDE

Still need a hand?

Tell us which plugin you're using and what you're trying to do.

Talk to Pimwick
Skip to content