Created
August 13, 2018 08:58
-
-
Save bappi-d-great/e33e99b01a32d223579eb3187cd311b6 to your computer and use it in GitHub Desktop.
WPMU DEV MARKETPRESS AUTO SELECT COUNTRY AND MAKING PHONE REQUIRED
This file contains hidden or 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( 'mp_checkout/address_fields_array', function( $address_fields, $type ) { | |
foreach( $address_fields as $key => $field ) | |
{ | |
if( trim( $field['label'] ) == 'Country' ) | |
{ | |
$address_fields[$key]['value'] = 'BD'; | |
} | |
else if( trim( $field['label'] ) == 'Phone' ) | |
{ | |
$address_fields[$key]['validation'] = array( | |
'required' => true, | |
); | |
} | |
} | |
return $address_fields; | |
}, 99, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment