Reputation: 41
It is necessary to hide “Ship to a Different Address?” text and checkbox in Woocommerce checkout. It means that only these elements of form should disappear without any changes to shipping fields. So “Ship to a Different Address?” checkbox must be checked but simply invisible. How to do it? Any help is greatly appreciated.
Upvotes: 0
Views: 3514
Reputation: 41
Hiding of “Ship to a Different Address?” text and checkbox in Woocommerce checkout was successfully done by editing form-shipping.php file. Instead of these lines
<h3 id="ship-to-different-address">
<label for="ship-to-different-address-checkbox" class="checkbox"><?php _e( 'Ship to a different address?', 'woocommerce' ); ?></label>
<input id="ship-to-different-address-checkbox" class="input-checkbox" <?php checked( apply_filters( 'woocommerce_ship_to_different_address_checked', 'shipping' === get_option( 'woocommerce_ship_to_destination' ) ? 1 : 0 ), 1 ); ?> type="checkbox" name="ship_to_different_address" value="1" />
</h3>
we should add these ones
<h3 id="ship-to-different-address">
<input id="ship-to-different-address-checkbox" class="input-checkbox" <?php checked( apply_filters( 'woocommerce_ship_to_different_address_checked', 'shipping' === get_option( 'woocommerce_ship_to_destination' ) ? 1 : 0 ), 1 ); ?> type="checkbox" style="display:none;" name="ship_to_different_address" value="1" />
</h3>
Upvotes: 2