Answer the question
In order to leave comments, you need to log in
How to hide zip field for specific selected country in drupal commerce addressfield at checkout stage?
When placing an order in Drupal Commerce, the checkout page asks for country, zip code, and more. How can I hide the index field only when a specific country is selected, for example RU? With all the rest, leave ..
As I understand it, an alter hook is needed. A lot of experiments have not yielded results. Has anyone been able to do something similar?
Do not offer the conditional_fields module! It works great, but with separate fields, it cannot parse the addressfield into parts ..
Answer the question
In order to leave comments, you need to log in
/**
* Implements hook_field_widget_WIDGET_TYPE_form_alter(): addressfield_standard.
*/
function hook_field_widget_addressfield_standard_form_alter(&$element, &$form_state, $context) {
if (страна ru) {
$element['locality_block']['postal_code']['#access'] = FALSE;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question