Shopify-Permalinks.js is an optional JavaScript package that allows developers to easily create Shopify Checkout objects that are backed by a Cart object. This is highly useful if you'd like to offer in-checkout offers for a headless storefront, which is ineligible for Rebuy's Checkout Extensions. It is extremely lightweight (under 1kB) with zero dependencies.

To use the package, install the script in your theme's head before the closing tag </head>:

<script src=""></script>

Please note that you should NOT use defer or async, which allows the script to load and be ready for use before the DOM content is loaded. The script is loaded from a CDN, so download times are typically below 40ms.

Once Shopify-Permalink.js is included, the package becomes globally available at window.ShopifyPermalink. You can now easily create new Cart-backed Checkouts for your customers!

Instead of using Shopify's Storefront API to create a new Checkout with their cart contents, you can instead create a new ShopifyPermalink object and simply call the go() method to redirect the customer to the checkout process.

Additionally, you can set options on the ShopifyPermalink to automatically apply discount codes, pre-populate customer information such as email, phone, and shipping address, or set order attributes for tracking.