How to force Shipping address?
-
For some items I am selling, they have to be sent to an approved receiver and cannot be sent directly to the purchaser. I have customized my checkout page to use existing fields for Shipping Address and have the page set to default to having the Ship To address section open using:
add_filter( 'woocommerce_ship_to_different_address_checked', '__return_true', 20);
I also added javascript to disable the checkbox. However, it looks like there is some event happening when a user clicks on the H3 for “Ship To a Different Address” that is allowing them to uncheck the checkbox and hide the shipping address section. At page load, the class looks like
<div class="shipping_address">
When the user clicks on the Ship To a Different Address text, I see the addition of a style to hid the section:
<div class="shipping_address" style="display: none;">
How can I fully force the “Ship To a Different Address” to always be displayed, required, and not able to be hidden by the user?I had also added these filters but they had no effect and still allow the order to be submitted if the user was able to hide the “Ship To a Different Address” section.
add_filter( 'woocommerce_cart_needs_shipping_address', '__return_true', 50 ); add_filter( 'woocommerce_order_needs_shipping_address', '__return_true', 50 );
- The topic ‘How to force Shipping address?’ is closed to new replies.