10 Shopify URL "Hacks" every developer should know
Whether I'm testing, debugging, or just trying to make my day a little more efficient, these simple but powerful URL shortcuts save me time. I’ve rounded up 10 Shopify URL hacks we use on a daily basis.
I’m not a Shopify developer myself, but I’m lucky enough to be surrounded by some of Denmark's most talented Shopify developers. Over the past 8 years, they've taught me a trick or two ✌🏼
Whether I'm testing, debugging, or just trying to make my day a little more efficient, these simple but powerful URL shortcuts save me time.
I’ve rounded up 10 Shopify URL hacks we use on a daily basis.
1. Clear the cart:
URL: /cart/clear
When testing a store, especially when adding or removing multiple products, it’s useful to be able to clear the cart instantly. This URL allows you to empty the cart with a single action, saving you time while testing.
2. View cart data in JSON:
URL: /cart.json
For debugging cart issues, this URL is a lifesaver. It provides all cart details in JSON format, including line items and their properties. If you’re working in Chrome, you can pretty-print the output, making it easier to scan through and debug.
3. Link to a pre-filled cart
URL: /cart/123456789:1
Need to quickly test a specific variant or create a cart pre-filled with products?
This URL allows you to add the specified quantity (in this case, 1) of the variant ID to the cart. You can also include multiple variants by separating them with commas (e.g., /cart/123456789:1,987654321:2
).
4. Permalink, but redirect to the site instead:
URL Modifier: Add ?storefront=true
or &storefront=true
If you want to create a permalink that adds a variant to the cart but redirects the user back to the store rather than to the checkout, this is the trick to use. It’s especially useful if you want to guide users back to the homepage or a specific collection.
5. Permalink with a discount code:
URL Modifier: Add ?discount=CODE
or &discount=CODE
Want to automatically apply a discount to the cart?
By adding this parameter to the URL, you can pre-apply a discount code for the user. You can even apply multiple discount codes using comma-separated values (e.g., ?discount=CODE1,CODE2
).
6. Prefill checkout fields:
URL: /checkout?checkout[email]=user@example.com
This hack allows you to prefill checkout fields, streamlining the user’s experience by saving them from inputting certain details. For example, you can prefill the email field with checkout[email]
, or shipping address fields like checkout[shipping_address][first_name]
. Append these parameters with ?
or &
depending on the context.
7. View all products:
URL: /collections/all
This well-known URL lists all products in the store, including any that are hidden from the front end (collections). It's a quick way to double-check if any products are accidentally visible to customers or to identify products you might want to hide.
I got 3 more tips for you and number 10 is my absolute favorite. Remember to hit that subscribe button to get full access.
8. Open a product page with a variant selected:
URL: /products/the-product?variant=123456789
Test how your theme handles pre-selected variants by appending the variant ID to the product URL.
This is particularly useful for ensuring that specific options are pre-selected when customers land on a product page. You can also share this URL directly with visitors for a more customized experience.
9. Display a specific template:
URL Modifier: ?view=template_name
If you’ve created a custom template (e.g., for pre-orders or sales), you can view it without assigning it to the product directly by using this query parameter. This method is perfect for reviewing and sharing specific template designs internally or with clients before launching them.
10. Theme preview that doesn’t expire:
URL Modifier: ?preview_theme_id=1234569
Normally, theme previews expire after a few hours, but this hack allows you to preview a specific theme indefinitely. Find the theme ID in the theme customizer URL, then append it to the store’s URL for a persistent preview.
Hit "customize" on the relevant theme and your URL will look like this: https://example.myshopify.com/admin/themes/1234569/editor
The ID is: 1234569