Hi, you can add the following Javascript code to your website:
function lpac_woofood_pickup_hide_map(){
echo "<script>
document.querySelectorAll('#woofood_order_type').forEach(el => {
el.addEventListener('click', (e) => {
if( e.target.value === 'pickup' ){
document.querySelector('#lpac-map-container').classList.add('hidden')
}
})
})
</script>";
}
add_action('wp_head', 'lpac_woofood_pickup_hide_map');
You can see here for details on creating a site specific plugin: https://lpacwp.com/docs/custom-code-samples/creating-a-site-specific-plugin/
Be sure to take a full backup of your website before adding the code.
hi
at which place on website i should add the following code
as i tried to add on css not work
by plugin add script on header and footer not work
and on theme function i recived error on echo "<script>
@mohamedzaky Please read the doc here: https://lpacwp.com/docs/custom-code-samples/creating-a-site-specific-plugin/ and use the plugin recommended to create a site specific plugin and then paste the code inside the custom plugin and ensure its activated.
You can also see this tutorial: https://www.youtube.com/watch?v=2RJ3VHC6VDo&ab_channel=WPBeginner-WordPressTutorials
hi uriahs
i added the plugin and activated it but not hide the map on pickup option still i can see
@mohamedzaky Please change this part of the code:
add_action('wp_head', 'lpac_woofood_pickup_hide_map');
To instead read:
add_action('wp_footer', 'lpac_woofood_pickup_hide_map');
Save the changes and try again
hi uriahs
thanks this disappeared the map on pickup but if i returned to choose delivery
the map still disappeared
first time on opening checkout page no problem on map on delivery choice but if i choose pickup and again select the delivery the map still disappeared
please double check below link
https://meals.atsaudia.com/en/checkout/
Hi please change the code to this instead:
function lpac_woofood_pickup_hide_map(){
echo "<script>
document.querySelectorAll('#woofood_order_type').forEach(el => {
el.addEventListener('click', (e) => {
if( e.target.value === 'pickup' ){
document.querySelector('#lpac-map-container').classList.add('hidden')
}
if( e.target.value === 'delivery' ){
document.querySelector('#lpac-map-container').classList.remove('hidden')
}
})
})
</script>";
}
add_action('wp_head', 'lpac_woofood_pickup_hide_map');
It should work fine after that.
hi uriahs
sorry this didnot help to disappear the map still the map appeared on pickup choice
@mohamedzaky Sorry please change this part of the code:
add_action('wp_head', 'lpac_woofood_pickup_hide_map');
To instead read:
add_action('wp_footer', 'lpac_woofood_pickup_hide_map');
Save the changes and try again
thanks uriahs for great support its ok now
No problem, if you have no more issues then please consider leaving a review for the plugin. It really helps keep me motivated to work on the plugin, you can leave a review here: https://wordpress.org/support/plugin/map-location-picker-at-checkout-for-woocommerce/reviews/
thanks sure i will leave 5 stars reviews