Close “Ship to a Different Address” by Default in WooCommerce

Quick Summary
- Add woocommerce_ship_to_different_address_checked with __return_false so the shipping checkbox starts unticked and customers see only the billing address.
- Using __return_true instead starts the box ticked with the shipping form visible, so add only one of the two lines.
- Without the filter, the default follows the Shipping destination setting, and stores forcing shipping to billing never show the checkbox.
On the WooCommerce checkout, the “Ship to a different address?” checkbox decides whether the shipping address fields are shown. Normally its starting state follows the Shipping destination option in WooCommerce’s shipping settings. The woocommerce_ship_to_different_address_checked filter lets you force it open or closed with a single line of code.
Add one of the two lines below to your child theme’s functions.php file. Use only one, since both change the same filter.
Open the shipping fields by default
add_filter( 'woocommerce_ship_to_different_address_checked', '__return_true' );__return_true is a WordPress helper function that simply returns true, so the checkbox starts ticked and the shipping address form is visible when the page loads.
Close the shipping fields by default
add_filter( 'woocommerce_ship_to_different_address_checked', '__return_false' );__return_false returns false, so the checkbox starts unticked and the customer only sees the billing address. They can still tick the box to enter a separate shipping address. If your store forces shipping to the billing address, the checkbox isn’t shown at all and these filters have no visible effect. With a similar one-line filter you can also set the default checkout country and state.
Source: the original snippet on Business Bloomer.
For checkout defaults and layouts set up around how your customers buy, see my WooCommerce development services.
Related articles
- changing the Order notes label and placeholder: another small checkout change made in functions.php
- a two-column checkout layout with CSS: arrange the billing and shipping sections side by side
