• Resolved fmiro

    (@fmiro)


    Helo
    How to assign a certain minimum order value to a gift card

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author pimwick

    (@pimwick)

    There isn’t an option built into the plugin to prevent redeeming a gift card until a certain amount has been added to the cart, however you could accomplish this using custom code with the pwgc_gift_card_can_be_redeemed hook:

    For example:

    1. Download the free Code Snippets plugin: https://ww.wp.xz.cn/plugins/code-snippets/
    2. Create a new Snippet with the following code (you can add the snippet to your functions.php instead of using Code Snippets if you are more familiar with that):

    function custom_pwgc_git_card_can_be_redeemed( $message, $gift_card ) {
        $gift_card_allowed = true;
    
        //
        // Here is where you need to write code to determine
        // if the cart will allow a gift card to be redeemed.
        //
    
        if ( ! $gift_card_allowed ) {
            $message = 'Gift cards cannot be used until order total is greater than $x.';
        }
    
        return $message;
    }
    add_filter( 'pwgc_gift_card_can_be_redeemed', 'custom_pwgc_git_card_can_be_redeemed', 10, 2 );
    Plugin Author pimwick

    (@pimwick)

    I’m marking this thread as resolved but let us know if you have any other questions.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘minimum order value’ is closed to new replies.