Magento 2.4
Ubuntu 18.04
level = 2 by res api:/V1/categories{
"category": {
"name": "Test category 2",
"parent_id":"3", /* Test category 1 */
"is_active":"true",
"include_in_menu": true,
"level":"2",
"custom_attributes": [{ "attribute_code": "url_key", "value": "test-category-2" }]
}
}
At now we have the url_key: "test-category-1" and path: "/test-category-1/test-category-2".
Category "Test category 2" has attribute values:
url_key: "test-category-2-changed"
url_path: "/test-category-1/test-category-2-changed"
Category "Test category 2" has attribute values:
url_key: "test-category-2-changed"
url_path: "test-category-2-changed"
Note
When I try to change a category url key, it changes the path to be identical which results in an error being raised and short category urls which don't include its parent, it has now affected categories that I haven't explicitly changed/saved.
(table catalog_category_entity_varchar)

As you can see from the screen shot (with url_key, attribute_id 117 and url_path, attribute_id 118) the mens-footwear category has been affected but not the womens-footwear category.
This looks like it could be related to issue #7298
Hi @AaronKaa. Thank you for report.
We can not reproduce the issue.
Can you confirm that the issue is reproducing on clean magento installation?
Thanks
I cant confirm that - the store itself has been updated from magento 2.1.5 and the data was imported via rest api (I should have mentioned that in the initial post), at this point were almost ready to go live with a new store.
We've found that editing the category using the api doesn't have this effect so we're going to do it that way for now.
@AaronKaa please more describe steps to reproduce the issue
We imported all of the categories and products via the REST API on version 2.1.5
Upgraded to 2.2.2
Tried to edit a category via both the web interface and the REST API and both produce the same results
Making a new category via the web interface and editing it doesn't have the same effect
I'm working with AaronKaa on this project. I think it's related to products added via the REST API.
For example, if you add a category with a parent category like this:
{
"category": {
"name": "Test",
"is_active": true,
"include_in_menu": true,
"level": LEVEL,
"position": 0,
"parent_id": PARENT_ID,
"custom_attributes": [{
"attribute_code": "url_key",
"value": "test"
}]
}
}
The url is at first correct, so say the parent category was called "Example" with the url key "example" we'd get: "/example/test".
But if we then try to change the url key of the test category either in the backend or via the api to something like "test-changed" we'd expect the new url path to be "/example/test-changed" but instead it becomes just "/test". So it looks like the url path is being set as the url key. This is happening with deeper categories as well.
Categories that were created manually in the backend and not with the api do not produce this result and work correctly however.
Hi @AaronKaa and @Lycanite
We were able to reproduce this issue by following steps:
level = 2 by res api:{
"category": {
"name": "Test category 2",
"parent_id":"3", /* Test category 1 */
"is_active":"true",
"include_in_menu": true,
"level":"2",
"custom_attributes": [{ "attribute_code": "url_key", "value": "test-category-2" }]
}
}
At now we have the url_key: "test-category-1" and path: "/test-category-1/test-category-2".
Category "Test category 2" has attribute values:
url_key: "test-category-2-changed"
path: "/test-category-1/test-category-2-changed"
Category "Test category 2" has attribute values:
url_key: "test-category-2-changed"
path: "test-category-2-changed"
@AaronKaa, thank you for your report.
We've acknowledged the issue and added to our backlog.
Looking at this further Ive found that the issue is the category level - manually re-setting the level to its correct value in the database and regenerating the urls fixed the issue
Hi @engcom-Echo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.4-develop branchDetails
- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Add label Issue: Confirmed once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
:white_check_mark: Confirmed by @engcom-Echo
Thank you for verifying the issue. Based on the provided information internal tickets MC-30130 were created
Issue Available: @engcom-Echo, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._
Hi @sergiy-v. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.[ ] 2. Verify that the issue is reproducible on 2.4-develop branchDetails
- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.
Hi @AaronKaa. Thank you for your report.
The issue has been fixed in magento/magento2#27304 by @sergiy-v in 2.4-develop branch
Related commit(s):
The fix will be available with the upcoming 2.4.0 release.
Most helpful comment
Hi @AaronKaa and @Lycanite
We were able to reproduce this issue by following steps:
Name: Test category 1, Url key: test-category-1.
level = 2by res api:At now we have the url_key: "test-category-1" and path: "/test-category-1/test-category-2".
Expected result:
Category "Test category 2" has attribute values:
url_key: "test-category-2-changed"
path: "/test-category-1/test-category-2-changed"
Actual result:
Category "Test category 2" has attribute values:
url_key: "test-category-2-changed"
path: "test-category-2-changed"