Shopify themes, liquid, logos, and UX
Hi There, I have the Ella theme. When I click the "add to cart" button, I would like for it to redirect me right to checkout, and skip the cart page since my store only has one item. Please let me know how I can achieve this.
Hi @gltl
You can check if your theme has that settings in Online Store > Themes > Customize > Theme settings > Cart
- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
Hi, it does, but it only has the redirect to cart page setting. I want to be able to redirect to checkout.
Could you share your product page link so I can check?
- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
Please add this code to Custom Liquid block below your Buy buttons on your Online store > Themes > Customize > Products > Default product and hide your default Pre-oder button
<button type="button" class="product-form__submit button button--primary an-horizontal-shaking button-text-change" onclick="addToCartAndCheckout()">Pre-order</button>
<script>
async function addToCartAndCheckout() {
const quantity = document.querySelector('input[name="quantity"]').value || 1;
const variantId = {{ product.variants.first.id }};
// Add the item to the cart
await fetch('/cart/add.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: variantId, quantity: quantity })
});
// Redirect to checkout
window.location.href = '/checkout';
}
</script>
- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
How can I still display the content below the pre-order button? The expected ship date and purple dot link.
So please update code and add it to Custom liquid code above 'Buy buttons'
<button type="button" class="product-form__submit button button--primary an-horizontal-shaking button-text-change" onclick="addToCartAndCheckout()">Pre-order</button>
<script>
async function addToCartAndCheckout() {
const quantity = document.querySelector('input[name="quantity"]').value || 1;
const variantId = {{ product.variants.first.id }};
// Add the item to the cart
await fetch('/cart/add.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: variantId, quantity: quantity })
});
// Redirect to checkout
window.location.href = '/checkout';
}
</script>
<style>
.product-form__buttons button { display: none !important; }
<style>
- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
That made everything disappear. I would like to display everything as normal (as is shown now in the link). The only thing I want to change is the redirect to the checkout.
Please add the code so I can check
- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
I'd rather use cart permalinks here -- do not need to wait for fetch to complete.
Given they offer only one product no need to worry about what's already in cart.
Like i suggested here
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025