craftcms/commerce

[5.x]: Changing handle of default inventory location returns 404 on Inventory settings page

timeverts opened this issue · 5 comments

What happened?

Description

I installed a fresh copy of Craft Commerce and then edited the default inventory location in the settings.
I changed the handle from default to something else, then saved the inventory location.
I then clicked on the 'Inventory' section in the Commerce settings menu and a 404 not found page came up. I expected to see the Inventory of my customised location.

Steps to reproduce

  1. Install Commerce with default settings
  2. In the CMS go to /admin/commerce/inventory-locations and edit the default inventory location
  3. Change the handle from default to something custom.
  4. Save the inventory location.
  5. Click the Inventory menu item in the Commerce settings.

Expected behavior

The inventory listing for the inventory location is displayed.

Actual behavior

A 404 Not Found error occurs.

Craft CMS version

5.1.3

Craft Commerce version

5.0.6

PHP version

8.3.7

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

I just tried this on a fresh install and couldn’t reproduce it. is the 404 still occurring? try clearing all caches and see if it comes back?

@lukeholder I took another look at this. The reason I ended up with a 404 was because the handle I specified had a hyphen in it (e.g. my-location). Without hyphens (myLocation), the inventory page loads fine.

Perhaps some validation on the handle field is required to prevent this happening?

Thanks this is fixed for the next release. The validator should have prevented dashes in handles and will in the next release.

Thanks.

Commerce 5.0.8 is out now with that fix. Thanks again!