Last active
November 18, 2021 17:46
-
-
Save cartimize/9063f63f7b9a2d0e9aa688f845ff5098 to your computer and use it in GitHub Desktop.
Address 2 field always show
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'cartimize_get_billing_checkout_fields', 'cartimize_address_1_billing_fields_always_show' , 10, 1 ); | |
function cartimize_address_1_billing_fields_always_show( $fields ){ | |
if ( !isset( $fields['billing_address_2'] ) ) { | |
return $fields; | |
} | |
unset( $fields['billing_address_2']['is_hidden'] ); | |
unset( $fields['billing_address_2']['cartimize_optional_label'] ); | |
$fields['billing_address_2']['required'] = true; | |
return $fields; | |
} | |
add_filter( 'cartimize_get_shipping_checkout_fields', 'cartimize_address_1_shipping_fields_always_show' , 10, 1 ); | |
function cartimize_address_1_shipping_fields_always_show( $fields ){ | |
if ( !isset( $fields['shipping_address_2'] ) ) { | |
return $fields; | |
} | |
unset( $fields['shipping_address_2']['is_hidden'] ); | |
unset( $fields['shipping_address_2']['cartimize_optional_label'] ); | |
$fields['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