Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clifgriffin/7e924d94e55702f017bb757ffe7522e1 to your computer and use it in GitHub Desktop.
Save clifgriffin/7e924d94e55702f017bb757ffe7522e1 to your computer and use it in GitHub Desktop.
Require address line 2 in the shipping address.
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
add_filter('woocommerce_checkout_fields', 'require_shipping_address2_checkout_field' );
function require_shipping_address2_checkout_field( $fields ) {
$fields['shipping']['shipping_address_2']['required'] = true;
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment