AppDrag Support Center

Programatically add a product to cart

Add a product to your cart programmatically

var cart = getCart();

var itemToAdd = {
  id: "12345", //id of your product in the shop
  title: "Your product title",
  sku: "YOURSKU",
  label: "",
  variantID: "",
  img: "URL_Of_THE_PRODUCT_IMAGE_HERE",
  qty: 1,
  aqty: 1,
  price: 24.99
};

cart.push(itemToAdd);
saveCart(cart);
showCart();

Other articles

Need More Help?

FAQ

If we've been asked before, it's in our Frequently Asked Questions!

Open FAQ

CHAT

Chat directly with the AppDrag team!

Open WebChat

Certified Partners

Not enough time to build your site? Find a Certified Partner to help you!

More Info