Redirect customer to external URL based on product purchased

I am trying to redirect customers to different external URL’s based on the product they purchase. For example, if they purchase product X, after successful checkout/payment it should redirect them to webpage X - not my shopify store. If they purchase product Y, after successful checkout/payment it should redirect them to webpage Y - not my shopify store, etc. Any help with this would be greatly appreciated.

There are different options, based on your plan, etc.

One way to do it is to run a code on a thank you page – https://help.shopify.com/en/manual/orders/status-tracking/customize-order-status/first-time-accessed

You would have access to the order liquid object there and can see what products your customer just purchased.

Hi @zachalmol12

Yes, this can be done by iterating the order object which will have the redirected URL.

You can create the metafield at product or variant level based on your requirement.

Write the custom code which pass this information at order success page.

Then use additional script code block available in settings → checkout

Iterate the order liquid and use script to open the URL in new tab.

Hope this will help…