Can I use the Shopify Ajax API or read+modify the user's cart from an app embed block?

Hi everyone,

I spent the past two years living on savings and actively developing an upselling app, and I’m about one month from launch.

The app uses a ScriptTag is used to inject a .js file to display offers to customers in full screen modal form. Shopify now tells me that I must an app embed block instead of a ScriptTag, and this will cripple my app because:

  1. This script makes heavy use of the Shopify Ajax API (to read and update the shopping cart) which I understand is inaccessible from within an app embed block as I understand that app blocks run in sandboxed web workers, and our app will be useless without this;

  2. This script must run on every page of the storefront because an offer may optionally be shown on any page;

  3. The script also runs on the Thank You page as offers may optionally be shown on that page, as well, using Shopify.Checkout.OrderStatus.addContentBlock;

  4. Offers must be able to show on non-2.0 themes which do not support app embed blocks.

Shopify Support says:

If you’re submitting a new app to the Shopify App Store, and it integrates with online stores, then your app must use theme app extensions. This will become a requirement for all apps in the Shopify App Store in the future. If you will be using the ScriptTag, your app will only work to those merchants that have old themes published to their stores. In addition to this, it might also prevent merchants from upgrading their themes.

It is critical the app continues using a ScriptTag, or the app will be functionally crippled, and two years of hard work and financial investment will have been completely wasted.

It seems I’m totally screwed, and all my efforts were useless?

Is there any way to access the Shopify Ajax API from an app embed block? Or another way to access the user’s cart and replace (remove+add) items (which is what the app does on upsell)?

Nevermind! I made a bad assumption that app embed blocks run in a sandboxed web worker environment, and this appears to not be the case.