Shopify themes, liquid, logos, and UX
When a customer adds a product to the cart, some Shopify themes will take them to the cart page. This customization lets customers stay on the product page after clicking the Add to cart button, so that they can continue shopping.
Note: Most free Shopify themes include a setting that lets customers stay on the product page when a product is added to the cart. You can enable this in the theme editor, in either the Cart page settings, or the Product page settings. In the theme preview, navigate to the cart page to access the Cart page settings, or navigate to the product page to access the Product page settings.
To edit your theme code:
theme.liquid
.</body>
tag. On a new line right above the closing </body>
tag, paste the following code:{% render 'ajaxify-cart' %}
ajaxify-cart
, and click Create snippet:ajaxify-cart.liquid
file, paste this code hosted on GitHub..size()
with .length
. The .size()
method is depreciated as of JQuery 1.8.
If you use Debut, then continue to the next steps:
ajaxify-cart.liquid
, find the opening <script>
tag at the top of the file. On a new line right below the opening <script>
tag, paste the following code:window.onload = function() {
</script>
tag. On a new line right above the closing </script>
tag, paste the following code:}
cartCountSelector: '.cart-count, #cart-count a:first, #gocart p a, #cart .checkout em, .item-count',
cartCountSelector: '#CartCount',
header.liquid
.{% if cart.item_count > 0 %}
{% if cart.item_count > -1 %}
Click here to view a demo store that lets customers stay on the product page when they add products to the cart.
TyW | Online Community Manager @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024