Hide FREE SHIPPING
-
Is there a way to hide flate rate shipping when a certain amount has been reached and kick in FREE SHIPPING ? The code below used to work until the upgrade now it gives you both options which is not good when someone goes to purchase a product that would require a shipping fee they will just choose FREE SHIPPING every time
add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 ); function hide_shipping_when_free_is_available( $rates, $package ) { if ( isset( $rates['free_shipping'] ) ) { unset( $rates['flat_rate'] ); $free_shipping = $rates['free_shipping']; $rates = array(); $rates['free_shipping'] = $free_shipping; } return $rates; } add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { unset($fields['billing']['billing_first_name']); unset($fields['billing']['billing_last_name']); unset($fields['billing']['billing_company']); unset($fields['billing']['billing_address_1']); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_city']); unset($fields['billing']['billing_postcode']); unset($fields['billing']['billing_country']); unset($fields['billing']['billing_state']); unset($fields['billing']['billing_phone']); unset($fields['order']['order_comments']); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_postcode']); unset($fields['billing']['billing_company']); unset($fields['billing']['billing_last_name']); unset($fields['billing']['billing_email']); unset($fields['billing']['billing_city']); return $fields; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Hide FREE SHIPPING’ is closed to new replies.