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

#   updating the cart

##

- **[Mat](/forum/user/4216-mat "View Mat's Profile")**
- [![Mat's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/4216-mat "View Mat's Profile") Topic Author
- [ Offline](/forum/user/4216-mat)

Less More

- Posts: 217
- Thank you received: 1
-
-

13 years 8 months ago [\#95149](#95149) by [Mat](/forum/user/4216-mat "View Mat's Profile")  *[updating the cart](/forum/2-general-talk-about-hikashop/79426-updating-the-cart#95149 "Hi all,  I use the following url to add a product to the cart:  index.php?option=com&#95;hikashop&amp;ctrl=product&amp;task=updatecart&amp;add=1&amp;quantity=1&amp;product&#95;id=47  now what if I want to add three products to the cart at once - is that possible?  Thanks,  Mat")* was created by *[Mat](/forum/user/4216-mat "View Mat's Profile")*

Hi all,

I use the following url to add a product to the cart:

index.php?option=com_hikashop&amp;ctrl=product&amp;task=updatecart&amp;add=1&amp;quantity=1&amp;product_id=47

now what if I want to add three products to the cart at once - is that possible?

Thanks,

Mat

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc5NDI2LXVwZGF0aW5nLXRoZS1jYXJ0P3RtcGw9bWFya2Rvd24=) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

13 years 8 months ago [\#95169](#95169) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[updating the cart](/forum/2-general-talk-about-hikashop/79426-updating-the-cart#95169 "Hi all,  I use the following url to add a product to the cart:  index.php?option=com&#95;hikashop&amp;ctrl=product&amp;task=updatecart&amp;add=1&amp;quantity=1&amp;product&#95;id=47  now what if I want to add three products to the cart at once - is that possible?  Thanks,  Mat")*

Hi,

I think that should URL should work in that case:
index.php?option=com_hikashop&amp;ctrl=product&amp;task=updatecart&amp;add=1&amp;data[47]=1&amp;data[48]=2

47 and 48 are the product ids and 1 and 2 are the quantities.

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

- **[Mat](/forum/user/4216-mat "View Mat's Profile")**
- [![Mat's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/4216-mat "View Mat's Profile") Topic Author
- [ Offline](/forum/user/4216-mat)

Less More

- Posts: 217
- Thank you received: 1
-
-

13 years 8 months ago [\#95173](#95173) by [Mat](/forum/user/4216-mat "View Mat's Profile")  Replied by *[Mat](/forum/user/4216-mat "View Mat's Profile")* on topic *[updating the cart](/forum/2-general-talk-about-hikashop/79426-updating-the-cart#95173 "Hi all,  I use the following url to add a product to the cart:  index.php?option=com&#95;hikashop&amp;ctrl=product&amp;task=updatecart&amp;add=1&amp;quantity=1&amp;product&#95;id=47  now what if I want to add three products to the cart at once - is that possible?  Thanks,  Mat")*

cheers

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

- **[Mat](/forum/user/4216-mat "View Mat's Profile")**
- [![Mat's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/4216-mat "View Mat's Profile") Topic Author
- [ Offline](/forum/user/4216-mat)

Less More

- Posts: 217
- Thank you received: 1
-
-

13 years 8 months ago -  13 years 8 months ago [\#95182](#95182) by [Mat](/forum/user/4216-mat "View Mat's Profile")  Replied by *[Mat](/forum/user/4216-mat "View Mat's Profile")* on topic *[updating the cart](/forum/2-general-talk-about-hikashop/79426-updating-the-cart#95182 "Hi all,  I use the following url to add a product to the cart:  index.php?option=com&#95;hikashop&amp;ctrl=product&amp;task=updatecart&amp;add=1&amp;quantity=1&amp;product&#95;id=47  now what if I want to add three products to the cart at once - is that possible?  Thanks,  Mat")*

and what if each product had custom fields that i wanted to add to each one?

this doesn't seem to work:
data[47]=1&amp;data[47][firstname]=qwerty&amp;data[48]=1&amp;data[item][firstname]=asdfgh
nor this:
data[47]=1&amp;data[item][firstname]=qwerty&amp;data[48]=1&amp;data[item][firstname]=asdfgh

it only adds the data item to the second object.

Last edit: 13 years 8 months ago by [Mat](/forum/user/4216-mat "View Mat's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc5NDI2LXVwZGF0aW5nLXRoZS1jYXJ0P3RtcGw9bWFya2Rvd24=) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

13 years 8 months ago [\#95208](#95208) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[updating the cart](/forum/2-general-talk-about-hikashop/79426-updating-the-cart#95208 "Hi all,  I use the following url to add a product to the cart:  index.php?option=com&#95;hikashop&amp;ctrl=product&amp;task=updatecart&amp;add=1&amp;quantity=1&amp;product&#95;id=47  now what if I want to add three products to the cart at once - is that possible?  Thanks,  Mat")*

You can't add several products with different custom field values at the same time via the add to cart URL.
You would have to code that in a PHP script instead.

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

- **[Mat](/forum/user/4216-mat "View Mat's Profile")**
- [![Mat's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/4216-mat "View Mat's Profile") Topic Author
- [ Offline](/forum/user/4216-mat)

Less More

- Posts: 217
- Thank you received: 1
-
-

13 years 8 months ago [\#95399](#95399) by [Mat](/forum/user/4216-mat "View Mat's Profile")  Replied by *[Mat](/forum/user/4216-mat "View Mat's Profile")* on topic *[updating the cart](/forum/2-general-talk-about-hikashop/79426-updating-the-cart#95399 "Hi all,  I use the following url to add a product to the cart:  index.php?option=com&#95;hikashop&amp;ctrl=product&amp;task=updatecart&amp;add=1&amp;quantity=1&amp;product&#95;id=47  now what if I want to add three products to the cart at once - is that possible?  Thanks,  Mat")*

can you show me an example of the code needed please?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc5NDI2LXVwZGF0aW5nLXRoZS1jYXJ0P3RtcGw9bWFya2Rvd24=) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

13 years 8 months ago [\#95466](#95466) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[updating the cart](/forum/2-general-talk-about-hikashop/79426-updating-the-cart#95466 "Hi all,  I use the following url to add a product to the cart:  index.php?option=com&#95;hikashop&amp;ctrl=product&amp;task=updatecart&amp;add=1&amp;quantity=1&amp;product&#95;id=47  now what if I want to add three products to the cart at once - is that possible?  Thanks,  Mat")*

Code:

$cartClass = hikashop_get('class.cart'); $cartContent = $cartClass-&gt;get(0, true, 'cart'); if(empty($cartContent)) { $cartClass-&gt;initCart(); } $cartClass-&gt;updateEntry(1, $cartContent, 47, 0, false); $cartClass-&gt;updateEntry(2, $cartContent, 48, 0, false);

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc5NDI2LXVwZGF0aW5nLXRoZS1jYXJ0P3RtcGw9bWFya2Rvd24=) 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.052 seconds

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