php - Drupal 7 commerce module billing country selection based on user -
i have problem drupal 7 commerce module.
we have country drop-down in home page , user can select country proceed shopping.
once in commerce billing section shows default country canada. want here based home page country selection have set same value country drop-down in billing section. please know how can implement this?.
i new drupal
same type of question can find here https://drupal.stackexchange.com/questions/120858/prepopulating-county-state-field-ajax-driven-field
can't country selected on homepage? maybe appears on url , can use current_path
to it? how deal when selected on homepage?
edit: if can access anywhere, can use hook_widget_form_alter in custom module this:
function your_module_field_widget_form_alter(&$element, &$form_state, $context) { $element['#address']['country'] = 'us'; }
replace 'your_module' module name. , change 'us' iso of user's country. , should add conditional statement on form_id apply change on checkout form. hope works!
Comments
Post a Comment