Can we hide one field on the checkout page, if the user chooses the Pickup Store
-
In our store, there are two shipping options (Standard & Pickup store).
We are using the WC Pickup Store (https://www.ads-software.com/plugins/wc-pickup-store/) plug-in to configure different stores and the user can select the stores from the checkout page.
We have configured the field “Google map location” as mandatory with the help of the Checkout Field Editor plug-in (https://www.ads-software.com/plugins/woo-checkout-field-editor-pro/).
We want to hide this field (Google map location), if the user selects the shipping option as “Pickup Store”.
If it optional field, we can hide it with the below jQuery.
function toggleGoogleMapField() { if ($('#shipping_method_0_wc_pickup_store').is(':checked')) { $('#billing_googlemap_location_field, #shipping_googlemap_location_field').hide(); } else { $('#billing_googlemap_location_field, #shipping_googlemap_location_field').show(); } } // Initial check on page load toggleGoogleMapField(); // Check when shipping method changes $('form.woocommerce-checkout').on('change', 'input[name="shipping_method[0]"]', function() { toggleGoogleMapField(); });
But if it is a mandatory field, it won’t work. Can you please help with this?
- You must be logged in to reply to this topic.