How to Automatically Add Products to Cart on Shopify: A Step-by-Step Guide

How to Automatically add to cart on Shopify


Shopify is an incredible platform for setting up and managing an online store. However, as an eCommerce business owner, you’re always looking for ways to optimize the customer experience and increase conversions. One way to achieve this is by automatically adding products to a customer’s cart on your Shopify store. This simplifies the purchasing process and can help drive more sales. In this blog post, we’ll walk you through a step-by-step guide on how to automatically add products to cart on Shopify. Let’s get started!

Here are the questions that people ask the most :

Can I automatically add a product to cart in Shopify?

There is no native feature on Shopify to automatically add items to your customer cart. You have two options. Either you code it yourself or you use an app to auto add to cart your products on Shopify

How do I automatically add free products on Shopify?

As said before, you’ll need an app to do so if you’re not willing to code it yourself

Option 1 : Option 2 : How to auto add items to cart on Shopify (without an app)

If you’re using the Dawn theme on Shopify and want to automatically add a specific item to your customer’s cart when they buy another specific item, you’ll need to modify your theme’s JavaScript code. Here’s a step-by-step guide on how to achieve this:

  1. Access your theme files: From your Shopify admin, go to “Online Store” > “Themes”. Find the Dawn theme you’re using and click on “Actions” > “Edit code”.
  2. Locate the JavaScript file: In the theme code editor, navigate to the “assets” folder and find the main JavaScript file. It is typically named “main.js” or “theme.js”.
  3. Add the following code snippet to the JavaScript file:
document.addEventListener('DOMContentLoaded', function() {
let specificProductId = 'XXXXX'; // Replace 'XXXXX' with the ID of the product that should trigger the automatic addition.
let itemToAddId = 'YYYYY'; // Replace 'YYYYY' with the ID of the product that should be automatically added to the cart.

let addToCartForm = document.querySelector('form[action="/cart/add"]');

if (addToCartForm) {
addToCartForm.addEventListener('submit', function(event) {
let selectedProductId ='input[name="id"]').value;

if (selectedProductId === specificProductId) {

function addItemToCart(itemId) {
fetch('/cart/add.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
body: JSON.stringify({
id: itemId,
quantity: 1

Make sure to replace ‘XXXXX’ with the ID of the product that should trigger the automatic addition and ‘YYYYY’ with the ID of the product that should be automatically added to the cart.

  1. Save your changes: Click the “Save” button to apply the changes to your theme.
  2. Test the functionality: Visit your online store, add the specific product to the cart, and verify that the additional item is automatically added as well.

Please note that this solution assumes that you’re using the default Shopify product form. If your theme has been heavily customized or uses a different form structure, you might need to modify the code accordingly. Also, keep in mind that modifying your theme’s code can cause unexpected issues, so it’s a good idea to make a backup of your theme before making any changes.

My best advise would be to use option 2.

Option 2 : How to auto add items to cart on Shopify (with an app)

Step 1: Choose the Right Shopify App to automatically add products to your customer cart

There are several apps available in the Shopify App Store that allow you to automatically add products to cart. Some popular options include:

  1. CartBot – See here
  2. EasyGift – See here
  3. BOT – See here
  4. Island Upsell – See here

Review each app’s features, pricing, and customer reviews to determine which one best suits your needs. Once you’ve chosen an app, install it in your Shopify store.

Step 2: Configure the Auto add to cart App Settings

After installing the app, you’ll need to configure its settings to customize how products are automatically added to the cart. This typically involves:

  1. Setting the conditions for when a product is added to the cart: For example, you might want a product to be automatically added when a customer purchases a specific item, spends a certain amount, or uses a particular discount code.
  2. Choosing which product(s) to add: You can select specific products or even entire collections to be added to the cart automatically.
  3. Defining the quantity of the added product(s): Specify how many units of each product will be added to the cart.

Step 3: Test the Automatic Add to Cart Feature

Once you’ve configured the app’s settings and once you’ve understood how to automatically add product on Shopify, test the feature to ensure it works as intended. Go through the customer journey on your store, making sure that the selected products are automatically added to the cart under the conditions you specified. If there are any issues, revisit the app settings and make any necessary adjustments.

Step 4: Monitor and Optimize your auto add to cart app

Keep an eye on your store’s analytics to determine the impact of the automatic add to cart feature on your sales and conversions. If you notice a positive impact, consider experimenting with different conditions, products, or quantities to further optimize the customer experience. If the results are not as expected, you may need to reevaluate your strategy or try a different app.


Learning how to automatically add product on Shopify can streamline the customer experience and potentially boost your sales. By choosing the right app, configuring its settings, testing the feature, and monitoring its impact, you can optimize your online store and drive more conversions. Don’t be afraid to experiment and adapt your strategy to ensure your customers have the best shopping experience possible. Happy selling!

Keywords: Shopify, automatically add products, cart, eCommerce, online store, customer experience, conversions, Shopify App Store, app settings, analytics, optimization.

Leave a Reply

Your email address will not be published. Required fields are marked *