mercredi 10 mars 2021

Set "Ship to different address" to mandatory when specific product is in cart/checkout

I'm trying to add a snipped to activate the "Ship to other address" open by default, when a specific product is in the checkout.
I found Enable 'Ship to a different address' check box for specific products in Woocommerce related answer thread which is working perfectly!

However, it should not be possible to unselect the check box "Ship to other address". If a specific product is in the checkout, then providing a different shipping address is required.

Goal: Gray-out the "Ship to other address" checkbox

I just changed in the code $products_ids = array(10800, 11907); to feet my needs.

I already tried to unhook the function but then the whole code does not work. So I'm searching the best way to gray-out that checkbox but keep the code above fully working.




Aucun commentaire:

Enregistrer un commentaire