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

#   hooking to the add to cart event

##

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

Less More

- Posts: 44
- Thank you received: 0
-
-

14 years 1 month ago [\#65910](#65910) by [mohamed](/forum/user/5767-mohamed "View mohamed's Profile")  *[hooking to the add to cart event](/forum/4-how-to/65910-hooking-to-the-add-to-cart-event#65910 "Is there a way to hook into the add to cart event meaning to see when an item is added to cart and get the current cart then prevent the action if possible. The reason I want to do this is that I need...")* was created by *[mohamed](/forum/user/5767-mohamed "View mohamed's Profile")*

Is there a way to hook into the add to cart event meaning to see when an item is added to cart and get the current cart then prevent the action if possible. The reason I want to do this is that I need to exercise some constrains on the number of products per cart as well as certain limits of the number of times a product may be purchased by a user.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzY1OTEwLWhvb2tpbmctdG8tdGhlLWFkZC10by1jYXJ0LWV2ZW50P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) 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: 86322
- Thank you received: 14281
-
-

14 years 1 month ago [\#66036](#66036) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: hooking to the add to cart event](/forum/4-how-to/65910-hooking-to-the-add-to-cart-event#66036 "Is there a way to hook into the add to cart event meaning to see when an item is added to cart and get the current cart then prevent the action if possible. The reason I want to do this is that I need...")*

You can use the limits button of the products listing to setup such limits without coding.

Otherwise, you can create a hikashop plugin and implement the event onBeforeCartUpdate.
You can look at the file administrator/components/com_hikashop/classes/cart.php for more information on that event.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzY1OTEwLWhvb2tpbmctdG8tdGhlLWFkZC10by1jYXJ0LWV2ZW50P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) 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.086 seconds

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