Disable Shipping from Documentation not Working
-
I followed the documentation to disable shipping, but it isnt working as expected, is there a free plugin that could disable shipping for a crowdfunding product, i added this code below in line 55 on wpcrowdfunding/includes/woocommerce/woocommerce.php and keep getting errors:
add_filter( 'woocommerce_cart_needs_shipping_address', array($this, 'disable_shipping') ); add_filter( 'woocommerce_cart_ready_to_calc_shipping', array($this, 'disable_shipping'), 99); function disable_shipping() { global $woocommerce; $has_crowdfunding_product = false; $items = $woocommerce->cart->get_cart(); if( $items) { foreach($items as $item => $values) { $product = wc_get_product( $values['product_id'] ); if( $product->get_type() == 'crowdfunding' ){ $has_crowdfunding_product = true; } } } return !$has_crowdfunding_product; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Disable Shipping from Documentation not Working’ is closed to new replies.