You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tested this with your sample templates to make sure it wasn't something I'd done.
If you have an address with a state, say US and Florida, then if you come to edit the record and change country to somewhere that doesn't require a state, say UK, then when you save the record still shows Florida as the selected state.
The only way it works is to put a non null string in the 'stateName' field, which isn't ideal.
Not sure when the state fields switched to using stateValue instead of the separate stateId and stateName, but I find it messier this way.
Bug seems to stem from the if statement on line 476 of models/Address.php as an empty string or '0' evaluate to False and therefore the stateId and and stateName don't get changed.
Steps to reproduce
Create a new US address and select a State.
Save
Edit the address, set Country to one without state, e.g France.
Save.
The address still has the previously selected State
Additional info
Craft version: 3.3.16.3
PHP version: 7.3.11
Database driver & version: MySQL 5.7.27
Plugins & versions: Craft Commerce 2.2.8
The text was updated successfully, but these errors were encountered:
Description
I've tested this with your sample templates to make sure it wasn't something I'd done.
If you have an address with a state, say US and Florida, then if you come to edit the record and change country to somewhere that doesn't require a state, say UK, then when you save the record still shows Florida as the selected state.
The only way it works is to put a non null string in the 'stateName' field, which isn't ideal.
Not sure when the state fields switched to using stateValue instead of the separate stateId and stateName, but I find it messier this way.
Bug seems to stem from the if statement on line 476 of models/Address.php as an empty string or '0' evaluate to False and therefore the stateId and and stateName don't get changed.
Steps to reproduce
Additional info
The text was updated successfully, but these errors were encountered: