When an order is completed using a Popup Storefront, by default the modal dialog will close and the window shade will vanish, returning customers to the page on your website that launched the Popup Storefront. However, you may prefer to redirect customers to a different page on your site (such as a custom "thank you" page) instead.
The example above checks for an order reference returned via the data-popup-closed event. If an order reference is present, it is logged to the browser's console and the customer is redirected to a custom page. If no order reference is present when the popup is closed, that indicates that popup was closed before reaching the completion page, implying that no order has been processed. In that case, the example above writes a simple message ("no order ID") to the browser's console log.
If the purchase has not been completed successfully (e.g. if the customer closes the dialog without purchasing), these values will be null.
For more information, please see Getting Started with Store Builder Library.