Shopify / shopify-app-bridge

https://shopify.dev/docs/api/app-bridge
86 stars 9 forks source link

Redirect to remote is not redirecting from app to checkout #200

Closed michalkuchtapl closed 1 year ago

michalkuchtapl commented 1 year ago

Describe the bug

Our app is embeded into Shopify Admin. We want to redirect customer from our app to checkout right after they create the draft order. It's not redirecting right now. The issue is only with the old store url format.

Example: My shopify store is: abcd.myshopify.com Admin panel: abcd.myshopify.com/admin App url: abcd.myshopify.com/admin/apps/my-app The customer creates the draft order and we redirect him to draft_order.invoice_url which is something like: https://abcd.myshopify.com/12345678/invoices/123c123a2a513de442a6df8f772ebc97

We use

redirect.dispatch(Redirect.Action.REMOTE, {
    url: draft.invoiceUrl
});

to redirect customer to the checkout. After we redirect customer to that url we see blank page inside the shopify admin. The url is working -when I hit refresh button in the browser.

I tried to run the same code on the new store with new shopify admin url: https://admin.shopify.com/store/my-store and it worked correctly, so I assume that the issue is only with the old shopify admin urls.

I know that it will work on production, because the prod store will have custom domain set up so the invoice_url will be different that the shopify admin store.

To Reproduce

Steps to reproduce the behaviour:

  1. Open app in the store with old admin url without custom domain.
  2. Redirect customer to the draft_order.invoice_url
  3. See error

Expected behaviour

It should redirect to the checkout where the payment can be processed

Contextual information

Packages and versions

List the relevant packages you’re using, and their versions. For example:

Platform

henrytao-me commented 1 year ago

@michalkuchtapl, this url seems wrong https://abcd.myshopify.com/12345678/invoices/123c123a2a513de442a6df8f772ebc97 => It supposes to have /admin/draft_orders if it is draft_orders.

michalkuchtapl commented 1 year ago

It should redirect customer to the checkout url not to the draft order in the admin.

michalkuchtapl commented 1 year ago

We have a situation when we don't want to redirect our staff to the draft order (Because they should not have permissions to see draft orders. We want to redirect them from our app to checkout, so they can finish creating order. In order to redirect them from our app to the checkout page we need to use invoice_url attribute from draft_order object.

henrytao-me commented 1 year ago

Hi @michalkuchtapl, I confirmed the issue. The team is working on a fix. We will post here when it's fixed.

henrytao-me commented 1 year ago

@michalkuchtapl This has been fixed on production. Let me know if you still see it 🙇