How to detect if checkout extension is running 'Shop Checkout Editor' vs. a real cart?

How to detect if checkout extension is running 'Shop Checkout Editor' vs. a real cart?

jmondi
Shopify Partner
1 0 1

I'm developing a checkout extension and need to differentiate between the "Online Shop Checkout Editor" environment and a real cart. My extension requires a valid checkout/user to display properly, resulting in empty space when previewed in the editor.


Is there a way to detect if the extension is running in the editor vs. a real cart? I've tried using window.location, but there's no access to the window object within the extension.

Ideally, I'd like to:

  1. Show a preview version of my extension in the editor
  2. Display the full, functional version in actual checkouts

Has anyone found a reliable method to achieve this? Any insights or workarounds would be greatly appreciated.

 

 2024-09-06 at 11.09.10 AM.png

Replies 0 (0)