[Skip to main content](#vessel-content)

#   Add products to the cart programmatically

##

- **[stuart@steedman.co.za](/forum/user/38146-stuart-steedman-co-za "View stuart@steedman.co.za's Profile")**
- [![stuart@steedman.co.za's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar38146.jpg)](/forum/user/38146-stuart-steedman-co-za "View stuart@steedman.co.za's Profile") Topic Author
- [ Offline](/forum/user/38146-stuart-steedman-co-za)

Less More

- Posts: 5
- Thank you received: 0
-
-
-
-

11 years 1 month ago [\#215406](#215406) by [stuart@steedman.co.za](/forum/user/38146-stuart-steedman-co-za "View stuart@steedman.co.za's Profile")  *[Add products to the cart programmatically](/forum/35-orders-management/879491-add-products-to-the-cart-programmatically#215406 "-- url of the page with the problem -- :   www.thankgodi.com  -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.9 -- Browser(s) name and version -- : Firefox 37.0.2 -- Error-message(debug-mod must be tuned on) -- : No error message  Hi guys,  I'm building a solution for my client, where I provide an interface that allows call center operators to create a cart with products on behalf of the customer (the caller). When the operator hits save, the cart is created (with products), and a mail is sent out to the customer, who when they click it, logs them in automatically, loads up their cart, and takes them straight to checkout.  In theory, this works well. In practice, I can't find out how to programmatically add items to a cart. If I try AJAX calls to something like:  &quot;option=com&#95;hikashop&amp;ctrl=product&amp;task=updatecart&amp;quantity=1&amp;checkout=1&amp;product&#95;id=X&quot;  Then I'm just told by Hikashop that the product is not available (it is...)  What is the best way to add items to a cart without using Hikashop's various interfaces?")* was created by *[stuart@steedman.co.za](/forum/user/38146-stuart-steedman-co-za "View stuart@steedman.co.za's Profile")*

-- url of the page with the problem -- : [ www.thankgodi.com](http://www.thankgodi.com)
-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.5.9
-- Browser(s) name and version -- : Firefox 37.0.2
-- Error-message(debug-mod must be tuned on) -- : No error message

Hi guys,

I'm building a solution for my client, where I provide an interface that allows call center operators to create a cart with products on behalf of the customer (the caller). When the operator hits save, the cart is created (with products), and a mail is sent out to the customer, who when they click it, logs them in automatically, loads up their cart, and takes them straight to checkout.

In theory, this works well. In practice, I can't find out how to programmatically add items to a cart. If I try AJAX calls to something like:

"option=com_hikashop&amp;ctrl=product&amp;task=updatecart&amp;quantity=1&amp;checkout=1&amp;product_id=X"

Then I'm just told by Hikashop that the product is not available (it is...)

What is the best way to add items to a cart without using Hikashop's various interfaces?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg3OTQ5MS1hZGQtcHJvZHVjdHMtdG8tdGhlLWNhcnQtcHJvZ3JhbW1hdGljYWxseT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14268
-
-

11 years 1 month ago [\#215408](#215408) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add products to the cart programmatically](/forum/35-orders-management/879491-add-products-to-the-cart-programmatically#215408 "-- url of the page with the problem -- :   www.thankgodi.com  -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.9 -- Browser(s) name and version -- : Firefox 37.0.2 -- Error-message(debug-mod must be tuned on) -- : No error message  Hi guys,  I'm building a solution for my client, where I provide an interface that allows call center operators to create a cart with products on behalf of the customer (the caller). When the operator hits save, the cart is created (with products), and a mail is sent out to the customer, who when they click it, logs them in automatically, loads up their cart, and takes them straight to checkout.  In theory, this works well. In practice, I can't find out how to programmatically add items to a cart. If I try AJAX calls to something like:  &quot;option=com&#95;hikashop&amp;ctrl=product&amp;task=updatecart&amp;quantity=1&amp;checkout=1&amp;product&#95;id=X&quot;  Then I'm just told by Hikashop that the product is not available (it is...)  What is the best way to add items to a cart without using Hikashop's various interfaces?")*

Hi,

An ajax request to that URL is indeed an easy solution you can use. If the system tells you that the product is not available it's probably that it isn't. It could be that it doesn't have stock, that you have some limits configured, or that the product is actually a product with characteristics and that you put the product_id of the main product instead of the product_id of the variant that you want to add, or that you didn't set any price in your product and that you have the Display add to cart button for free products turned off in the hikashop configuration.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg3OTQ5MS1hZGQtcHJvZHVjdHMtdG8tdGhlLWNhcnQtcHJvZ3JhbW1hdGljYWxseT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.106 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
