Snippet remove fields checkout
-
Hi, until a few months ago it was possible with a snippet if I had a coupon to deactivate some fields, now the snippet only works if I deactivate the plugin it is as if they conflicted, leaving it active does not remove any fields
add_filter( 'woocommerce_checkout_fields' , 'remove_fields_checkout' ); function remove_fields_checkout( $fields ) { if (!empty(WC()->cart->applied_coupons)){ if (in_array("summer", WC()->cart->applied_coupons)) { //unset($fields['billing']['billing_first_name']); //unset($fields['billing']['billing_last_name']); 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['billing']['billing_wooccm11']); unset($fields['billing']['billing_wooccm12']); unset($fields['billing']['billing_wooccm16']); //unset($fields['billing']['billing_company']); //unset($fields['billing']['billing_email']); unset($fields['order']['order_comments']); } } return $fields; }
Thanks in advance
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Snippet remove fields checkout’ is closed to new replies.