The store address field can disappear and a very special occasion.
Here is how to reproduce on FF Linux at least.

  • Create a new store,
  • Change the country address,
  • Change again the country address to pick the "select" value
  • KABOOM the address field disappears.
CommentFileSizeAuthor
#5 address-required-2633972-5.patch1.03 KBczigor
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Artusamak created an issue. See original summary.

czigor’s picture

Status: Active » Postponed (maintainer needs more info)

I'm not sure I can reproduce this. Here's what I've done:
1. I created a store with country 'Switzerland'. Saved the store.
2. Edited the store and changed the country to 'Afghanistan'. Saved the store.
3. Edited the store again and changed the country to 'Select'. The other address fields disappeared but I think that's the intended behaviour. When I select a country, they come back.

Artusamak’s picture

I think that when you click on "Select" the address section shouldn't be refreshed.

bojanz’s picture

Status: Postponed (maintainer needs more info) » Active

Ah, I now understand.

This is the correct behavior, Select is supposed to hide the fields and store nothing.
However, the store address is a required field, so there shouldn't actually be a "Select" option.
That's our bug.

czigor’s picture

Project: Commerce Core » Address
Version: 8.x-2.x-dev » 8.x-1.x-dev
Component: Store » Code
Status: Active » Needs review
FileSize
1.03 KB

This is an Address bug, also present in Profile addresses for example.

The issue is that the $address_element['country_code']['#empty_value'] is set and this triggers adding the '- Select -' option in \Drupal\Core\Render\Element\Select::processSelect(). #empty_value should only be set if the address is not required.

Patch solves this.

czigor’s picture

Title: Store country address AJAX bug » Required addressfield has a '- Select -' option.
czigor’s picture

Title: Required addressfield has a '- Select -' option. » Required addressfield has a '- Select -' option
bojanz’s picture

Status: Needs review » Fixed

Committed, thanks!

  • bojanz committed 714ad0f on 8.x-1.x authored by czigor
    Issue #2633972 by czigor: Required addressfield has a '- Select -'...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.