Forum

Thread tagged as: Question, Shop

Perch Shop Add to cart

Hi guys

I'm using Perch shop for first time and I think I maybe missing something, please excuse the noob question but I've seen references to the perch_shop_add_to_cart() function on the forum, I just can't see anything in the official documentation about this function, or the options it requires?

https://docs.grabaperch.com/addons/shop/cart/functions/

Am I missing something?

Many thanks

Lee Goodman

Lee Goodman 0 points

  • 5 years ago

Ok found it

https://docs.grabaperch.com/addons/shop/cart/

Are there any examples of arguments to pass to this function and example usage?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Arguments are:

  1. ID of the product to add
  2. qty
  3. true/false whether to replace the existing qty in the cart with this qty (true) or adjust the qty by this value (false)

You shouldn't need this function unless you're adding items to the cart programatically.

Great thanks Drew.