Jump to content

How to add product to cart programmatically


Recommended Posts



I'm making a file which will add some products to the cart in PrestaShop, but it doesn't work.

Here is my code:




$id_product = $_GET['id_product'];
$attribute = $_GET['attribute'];

$cart=new Cart($id_cart);
$cart->updateQty(1, $id_product, $attribute, false);
So I execute it from file.php?id_product=555&attribute=666
It doesn't work. Why?

Share this post

Link to post
Share on other sites

  • 2 months later...
  • 1 year later...
  • 10 months later...
  • 11 months later...
  • 11 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More