-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions
Magento 2.1.2 CE
Multiple websites configured
Steps to reproduce(working):
- go in admin area
- clear url-key field in product
- keep checked "Create Permanent Redirect for old URL"
- changes product name
- save
Steps to reproduce(broken):
- call myownmagento.test/index.php/rest/all/V1/products with correct authentication token with json data and url_key_create_redirect or save_rewrites_history to 1
example with sample data:
{"product":{"sku":"WSH10","name":"Ana Running Short changed","attribute_set_id":9,"price":0,"status":1,"visibility":4,"type_id":"configurable","weight":"0.1","extension_attributes":{"configurable_product_links":[2016,2017,2018,2019,2020,2021],"stock_item":{"use_config_enable_qty_inc":false,"manage_stock":true,"is_in_stock":true}},"custom_attributes":[{"attribute_code":"tax_class_id","value":2},{"attribute_code":"required_options","value":1},{"attribute_code":"has_options","value":1},{"attribute_code":"category_ids","value":["254"]},{"attribute_code":"description","value":"Test"},{"attribute_code":"url_key","value":""},{"attribute_code":"url_key_create_redirect","value":1}]}}
Expected result
- old product url is redirected to new one
Actual result
- old url go in 404 error
Some additionals notes:
I noticed that in admin area saving product and import there is a url_key_create_redirect check by code to force the url redirection that missing completely in API feature