Delete Country Breaks Shipping Zone Limit

Open to all! Ask other shopowners for help.
Post Reply
User avatar
zipurman
Builder
Posts: 540
Joined: Tue Oct 13, 2020 5:20 pm
Phoenix Version: v
Has thanked: 93 times
Been thanked: 162 times

Delete Country Breaks Shipping Zone Limit

Post by zipurman »

Just noticed...

If I have an address that has a country of Canada for example .... and I create an order, I am limited to shipping mods based on my Country. This works fine.

If I delete Canada from the countries database, I can now checkout with any shipping mod as the limits no longer apply to my Canada address since it has been removed from the database. It is still assigned to my address book ... so all looks fine from the client's end.

Thoughts?
zipurman
-----------


Join The Code Co-op to get access to your library in the Code Co-op Forum
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Delete Country Breaks Shipping Zone Limit

Post by heatherbell »

zipurman wrote: Tue Dec 13, 2022 7:56 am If I delete Canada from the countries database...
Thoughts?
Mmm? No help but my thoughts are don't delete Canada? I mean, in any context, at least think of all the beavers and bears! ;) :)
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Delete Country Breaks Shipping Zone Limit

Post by ecartz »

Or at least, don't delete Canada from the countries table without also deleting it from the address_book and zones_to_geo_zones tables.

From where you are now, you might see if you can delete a row from the zones_to_geo_zones table relating the non-existent country with a zone and the geo-zone that comes through in the limitation. Because the default when a shipping zone is specified is to refuse to ship. So if it is shipping, that suggests that there is an entry allowing it in zones_to_geo_zones.

If you want to block deleting the country when it has zones_to_geo_zones or address_book entries, you could add a preAction hook that checks for a delete_confirm or delete action and shows a warning if someone tries to delete a country that is still in the address_book/zones_to_geo_zones tables. I'm a bit reluctant to make the equivalent core change at this point in the 1.0.8.* series, but we could talk about it again in the 1.0.9.0 series.
User avatar
zipurman
Builder
Posts: 540
Joined: Tue Oct 13, 2020 5:20 pm
Phoenix Version: v
Has thanked: 93 times
Been thanked: 162 times

Re: Delete Country Breaks Shipping Zone Limit

Post by zipurman »

heatherbell wrote: Wed Dec 14, 2022 8:09 am
zipurman wrote: Tue Dec 13, 2022 7:56 am If I delete Canada from the countries database...
Thoughts?
Mmm? No help but my thoughts are don't delete Canada? I mean, in any context, at least think of all the beavers and bears! ;) :)
LOL ... don't forget all the dog sleds and igloos ;)
zipurman
-----------
User avatar
zipurman
Builder
Posts: 540
Joined: Tue Oct 13, 2020 5:20 pm
Phoenix Version: v
Has thanked: 93 times
Been thanked: 162 times

Re: Delete Country Breaks Shipping Zone Limit

Post by zipurman »

ecartz wrote: Wed Dec 14, 2022 9:20 am .... , but we could talk about it again in the 1.0.9.0 series.
I think a better option would be to add an on/off setting for each country. That would allow countries to be disabled and then reenabled as needed. There would then need to be something added throughout to make sure that setting was adhered to ;) Also, an easier way of enable/disable by selecting by checkmark or something as right now the only way to do this in mass is through SQL or hours of single edits ;)
zipurman
-----------


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply