Skip to content

Instantly share code, notes, and snippets.

@bappi-d-great
Created August 13, 2018 08:58
Show Gist options
  • Save bappi-d-great/e33e99b01a32d223579eb3187cd311b6 to your computer and use it in GitHub Desktop.
Save bappi-d-great/e33e99b01a32d223579eb3187cd311b6 to your computer and use it in GitHub Desktop.
WPMU DEV MARKETPRESS AUTO SELECT COUNTRY AND MAKING PHONE REQUIRED
<?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