Are product redirects respected on a product-handle.json level?

Highlighted
Shopify Partner
39 1 12

My client has a third-party set-up that generates a PDF based on the products on a customer's order.

So the order is accessed via REST, which then grabs the products via the public /products/product-handle.json API.

 

The problem we're now facing, is if a product's handle gets updated due to misspelling etc, the PDF functionality can break because a customer's ordered product technically no longer exists at it's original handle.

 

I'm wondering if product redirects might be respected on a JSON level? So a redirect set up will automatically point to red-tshirt when the original purchased product was red-tshort.

Liam Merlyn | Shopify Developer
0 Likes
Highlighted
Shopify Partner
347 25 50

Hello,

 

From testing creating a product redirect does not create a new handle. Also removing the misspelled product from the online store product availability will not give access to that object.

 

Custom Apps and Themes Support | Email us: hello@achieveapplabs.com | Follow us on Twitter @achieveapplabs | New Monthly Support by Achieve Applabs www.achieveapplabs.com
0 Likes
Highlighted
Shopify Partner
39 1 12

Thanks for that, I thought that might be the case.

 

Do you have any guesses on alternative ways I can resolve this?

Liam Merlyn | Shopify Developer
0 Likes
Highlighted
Shopify Partner
347 25 50

Encourage to use product ID as the handle. I'm sure that's not always a possibility but if the order is accessed via Shopify REST API then the ID of the product should be in there. Assuming the logic that handles the order is pulling the title currently and then making a call to products/handle.json

 

Just a thought: If there is just one or two items that are causing this issue a hack would be to "hide" the product within the theme files. Like go into list-collections or similar and check for product.title !== 'misspelled' that could be something. With the current logic that product handle should exist so if the code can't be changed then the misspelled product should at the very least exist within Shopify.

Custom Apps and Themes Support | Email us: hello@achieveapplabs.com | Follow us on Twitter @achieveapplabs | New Monthly Support by Achieve Applabs www.achieveapplabs.com
0 Likes