add_filter('woocommerce_checkout_fields', 'local_pickup_remove_billing_checkout_fields');
function local_pickup_remove_billing_checkout_fields($fields) {
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
$chosen_shipping = $chosen_methods[0];
if ( 0 === strpos( $chosen_shipping, 'local_pickup' ) ) {
unset($fields['billing']['billing_address_1']); // Eliminar el campo Dirección 1
unset($fields['billing']['billing_address_2']); // Eliminar el campo Dirección 2
unset($fields['billing']['billing_postcode']); // Elimina el Código Postal
unset($fields['billing']['billing_state']); // Elimina la Provincia
unset($fields['billing']['billing_country']); // Elimina el País
}
return $fields;
}
https://es.wordpress.org/support/topic/ocultar-campos-al-seleccionar-recogida-local/
0 Comentarios