• Hi, I have a few questions about this plugin.

    1) Is it possible if I wanted to disable the customer from purchasing a gift card with a gift card code?
    2) Can we limit/restrict products that can be purchased using this gift card? For example, I already have a very cheap product in my store, so I don’t want to allow customers from buying the cheap product using the gift card.

    Thank you!

Viewing 1 replies (of 1 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hello there,
    hope you are doing well! ??

    1) Unfortunately, this feature is not included in the free version of the plugin, sorry.

    2) We have created the next code to achieve what you need. You only have to replace the number “1234” by the ID of the product you want to restrict, and then, add the code in the functions.php of your active theme.

    if( ! function_exists('yith_ywgc_check_gift_card_return_custom')) {
        function yith_ywgc_check_gift_card_return_custom( $bool ) {
            $items = WC()->cart->get_cart();
    
            foreach ( $items as $cart_item_key => $values ) {
                $product = $values['data'];
                $product_name =  $product->get_name();
                if ( $product->get_id() == '1234' ){
                    wc_add_notice( __( 'It is not possible to add gift cards when the cart contains the next product: ' . $product_name, 'yith-woocommerce-gift-cards'), 'error' );
    
                    $bool = false;
                }
            }
            return $bool;
        }
        add_filter( 'yith_ywgc_check_gift_card_return', 'yith_ywgc_check_gift_card_return_custom', 10 );
    }

    Could you check it and let us know, please?

    Have a nice day!

Viewing 1 replies (of 1 total)
  • The topic ‘Disable gift card on certain product’ is closed to new replies.