• Resolved hhatziioannou

    (@hhatziioannou)


    I’m using the Gift Wrapping for WooCommerce plugin. However, I have certain products that I do not want to offer the gift wrapping option for, because they do not fit in a gift package, for example. Is there a way to exclude specific products from the gift wrapping option, perhaps by adding some custom code to the functions.php file?

Viewing 1 replies (of 1 total)
  • Plugin Author Pexle Chris

    (@pexlechris)

    Yes, you can do it using woocommerce_form_field filter.

    But have in mind that there are not gift wrappers for each product, so If you have one product that could take gift wrapper and another that cannot, you need to determine what you need to do!

    Example you can find above

    add_filter('woocommerce_form_field', function($field, $key){
    	
    	// Example of function is_product_in_cart() above: 			
    	// https://tinyurl.com/mswkd9az
    
    	// You can set your conditions here
    	$disable_gift_wrapper = true; 
    	
    	if( $key == 'tgpc_enable_checkout_gift_wrapper' && 
    		$disable_gift_wrapper ){
    		return '';
    	}
    	
    	return $field;
    }, 10, 2);

    Helpful Docs: How to add PHP Hooks in your WordPress Site – DOCS

Viewing 1 replies (of 1 total)
  • The topic ‘Excluding Specific Products from Gift Wrapping Option in WooCommerce’ is closed to new replies.