Removing checkout fields based on service
-
hello i have 2 issues, the first one is that i have 2 delivery methods local pickup and free shipping but after installing this plugin i am only showed local pickup shipping regardless if i disable the service types or select deliver.
the second issue is i want to hide the address fields if pickup is selected but i cant seem to get the value from service type field for some reason with this code
add_filter('woocommerce_checkout_fields', 'xa_remove_billing_checkout_fields'); function xa_remove_billing_checkout_fields($fields) { $service_method ='pickup'; global $woocommerce; $chosen_methods = WC()->checkout->get_value( 'wfs_service_type' ); $chosen_service = $chosen_methods[0]; if ($chosen_service == $service_method) { unset($fields['billing']['billing_address_1']); // Add/change filed name to be hide unset($fields['billing']['billing_address_2']); } return $fields; }
if i keep ($service_method = ”) then the fields are hidden meaning the variable is not getting any value from service type can you help or make any correction please will be really greatful
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Removing checkout fields based on service’ is closed to new replies.