Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

No 301 redirect created when handle updated via API

No 301 redirect created when handle updated via API

Slappadabass
Shopify Partner
2 0 0

I am experiencing an issue with the following use case:

 

  1. A product XYZ123 is published in PIM, which triggers creation of a product record in Shopify
  2. The Shopify handle is generated by PIM using the product name and SKU: /this-product-here-xyz123
  3. Marketer then uses the /this-product-here-XYZ123 URL to sell stuff
  4. Product Manager makes a brand-required update of the product name to "Our Brand This Product Here" in ERP/PLM
  5. ERP/PLM updates product name to "Our Brand This Product Here" in PIM 
  6. PIM updates Shopify via the API and changes the handle/URL to /our-brand-this-product-here-xyz123

At this point:

  • Unless I'm missing something, any external links to the product above are now broken, as a change to the handle/URL via API does not generate a 301 redirect
  • I do understand that 301s are created when the handle/URL is updated within the product record in Shopify (when the option is selected)
  • I'm looking to understand if there is some means to generate a 301 on any change to the handle/URL, as this created a significant issue for marketing efforts during BF/CM. 
Reply 1 (1)

Liam
Community Manager
3108 344 911

Hi Slappadabass,

 

As per the current Shopify API documentation, there's no automated way to create 301 redirects when you change the product handle via API. The 301 redirects are only auto-generated when you modify the handle from within Shopify's admin panel and specifically opt for it.

 

However, as a workaround, you could use the Redirect API to manually create a redirect when a product URL changes. You would have to track the changes in your product URLs and create a 301 redirect from the old URL to the new one every time a change occurs. 

 

Hope this helps,

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog