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

#   Triggering javascript after add to cart ajax call

##

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

Less More

- Posts: 18
- Thank you received: 2
-
-

12 years 1 month ago [\#173440](#173440) by [mj](/forum/user/8198-mj "View mj's Profile")  *[Triggering javascript after add to cart ajax call](/forum/26-product-category-display/871924-triggering-javascript-after-add-to-cart-ajax-call#173440 "-- url of the page with the problem -- :   69.28.90.77/~macautomation/index.php/onl...d06-detachable-chute  -- HikaShop version -- : 3.3.3 -- Joomla version -- : 3.3.3 -- PHP version -- : 5.4.29 -- Browser(s) name and version -- : chrome -- Error-message(debug-mod must be tuned on) -- : None - I want to add some code  I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the  tag of my pages.  Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display. Here's the code I'd like to add: jQuery(&quot;html, body&quot;).animate({ scrollTop: 0 }, &quot;slow&quot;); jQuery(&quot;#hikashop&#95;cart&#95;module&quot;).show();  Could you please let me know the file /line number which I could add this?  Thank you!")* was created by *[mj](/forum/user/8198-mj "View mj's Profile")*

-- url of the page with the problem -- : [ 69.28.90.77/~macautomation/index.php/onl...d06-detachable-chute](http://69.28.90.77/~macautomation/index.php/online-store/mold-chutes/product/12-model-md06-detachable-chute)
-- HikaShop version -- : 3.3.3
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.4.29
-- Browser(s) name and version -- : chrome
-- Error-message(debug-mod must be tuned on) -- : None - I want to add some code

I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the &lt;head&gt; tag of my pages.

Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display.
Here's the code I'd like to add:
jQuery("html, body").animate({ scrollTop: 0 }, "slow");
jQuery("#hikashop_cart_module").show();

Could you please let me know the file /line number which I could add this?

Thank you!

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

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26395
- Thank you received: 4077
-
- [](http://obsi.dev)
-

12 years 1 month ago [\#173460](#173460) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Triggering javascript after add to cart ajax call](/forum/26-product-category-display/871924-triggering-javascript-after-add-to-cart-ajax-call#173460 "-- url of the page with the problem -- :   69.28.90.77/~macautomation/index.php/onl...d06-detachable-chute  -- HikaShop version -- : 3.3.3 -- Joomla version -- : 3.3.3 -- PHP version -- : 5.4.29 -- Browser(s) name and version -- : chrome -- Error-message(debug-mod must be tuned on) -- : None - I want to add some code  I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the  tag of my pages.  Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display. Here's the code I'd like to add: jQuery(&quot;html, body&quot;).animate({ scrollTop: 0 }, &quot;slow&quot;); jQuery(&quot;#hikashop&#95;cart&#95;module&quot;).show();  Could you please let me know the file /line number which I could add this?  Thank you!")*

Hi,

It is currently not possible unless you modify the HikaShop core.
We planned to rewrite the "add to cart" system and add some javascript events (triggers) in order to add new features and also let you (and the other users) implement your own javascript code using the events.

But for the moment, the best is to modify the HikaShop core to add your code.

regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

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

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

Less More

- Posts: 18
- Thank you received: 2
-
-

12 years 1 month ago [\#173500](#173500) by [mj](/forum/user/8198-mj "View mj's Profile")  Replied by *[mj](/forum/user/8198-mj "View mj's Profile")* on topic *[Triggering javascript after add to cart ajax call](/forum/26-product-category-display/871924-triggering-javascript-after-add-to-cart-ajax-call#173500 "-- url of the page with the problem -- :   69.28.90.77/~macautomation/index.php/onl...d06-detachable-chute  -- HikaShop version -- : 3.3.3 -- Joomla version -- : 3.3.3 -- PHP version -- : 5.4.29 -- Browser(s) name and version -- : chrome -- Error-message(debug-mod must be tuned on) -- : None - I want to add some code  I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the  tag of my pages.  Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display. Here's the code I'd like to add: jQuery(&quot;html, body&quot;).animate({ scrollTop: 0 }, &quot;slow&quot;); jQuery(&quot;#hikashop&#95;cart&#95;module&quot;).show();  Could you please let me know the file /line number which I could add this?  Thank you!")*

So which file would that be?

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

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

Less More

- Posts: 18
- Thank you received: 2
-
-

12 years 1 month ago [\#173518](#173518) by [mj](/forum/user/8198-mj "View mj's Profile")  Replied by *[mj](/forum/user/8198-mj "View mj's Profile")* on topic *[Triggering javascript after add to cart ajax call](/forum/26-product-category-display/871924-triggering-javascript-after-add-to-cart-ajax-call#173518 "-- url of the page with the problem -- :   69.28.90.77/~macautomation/index.php/onl...d06-detachable-chute  -- HikaShop version -- : 3.3.3 -- Joomla version -- : 3.3.3 -- PHP version -- : 5.4.29 -- Browser(s) name and version -- : chrome -- Error-message(debug-mod must be tuned on) -- : None - I want to add some code  I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the  tag of my pages.  Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display. Here's the code I'd like to add: jQuery(&quot;html, body&quot;).animate({ scrollTop: 0 }, &quot;slow&quot;); jQuery(&quot;#hikashop&#95;cart&#95;module&quot;).show();  Could you please let me know the file /line number which I could add this?  Thank you!")*

Nevermind, I found it in /com_hikashop/helpers/cart.php.

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

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

Less More

- Posts: 7
- Thank you received: 0
-
-

4 years 10 months ago [\#338002](#338002) by [mabdelaziz](/forum/user/62648-mabdelaziz "View mabdelaziz's Profile")  Replied by *[mabdelaziz](/forum/user/62648-mabdelaziz "View mabdelaziz's Profile")* on topic *[Triggering javascript after add to cart ajax call](/forum/26-product-category-display/871924-triggering-javascript-after-add-to-cart-ajax-call#338002 "-- url of the page with the problem -- :   69.28.90.77/~macautomation/index.php/onl...d06-detachable-chute  -- HikaShop version -- : 3.3.3 -- Joomla version -- : 3.3.3 -- PHP version -- : 5.4.29 -- Browser(s) name and version -- : chrome -- Error-message(debug-mod must be tuned on) -- : None - I want to add some code  I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the  tag of my pages.  Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display. Here's the code I'd like to add: jQuery(&quot;html, body&quot;).animate({ scrollTop: 0 }, &quot;slow&quot;); jQuery(&quot;#hikashop&#95;cart&#95;module&quot;).show();  Could you please let me know the file /line number which I could add this?  Thank you!")*

Hi,

If this feature is implemented, any reference or documentation there?
I mean " add to cart javascript events (triggers)"

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84NzE5MjQtdHJpZ2dlcmluZy1qYXZhc2NyaXB0LWFmdGVyLWFkZC10by1jYXJ0LWFqYXgtY2FsbD90bXBsPW1hcmtkb3du) 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: 86359
- Thank you received: 14296
-
-

4 years 10 months ago [\#338003](#338003) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Triggering javascript after add to cart ajax call](/forum/26-product-category-display/871924-triggering-javascript-after-add-to-cart-ajax-call#338003 "-- url of the page with the problem -- :   69.28.90.77/~macautomation/index.php/onl...d06-detachable-chute  -- HikaShop version -- : 3.3.3 -- Joomla version -- : 3.3.3 -- PHP version -- : 5.4.29 -- Browser(s) name and version -- : chrome -- Error-message(debug-mod must be tuned on) -- : None - I want to add some code  I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the  tag of my pages.  Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display. Here's the code I'd like to add: jQuery(&quot;html, body&quot;).animate({ scrollTop: 0 }, &quot;slow&quot;); jQuery(&quot;#hikashop&#95;cart&#95;module&quot;).show();  Could you please let me know the file /line number which I could add this?  Thank you!")*

Hi,

This has been implemented yes.
We actually have plugins using that mechanism like the cart slide notification ( [ www.hikashop.com/marketplace/product/120-cartnotify\_slide.html](https://www.hikashop.com/marketplace/product/120-cartnotify_slide.html) ) and the HikaShop cart notify plugin (pre installed with HikaShop).
That second plugin is responsible for displaying the add to cart notification box after the add to cart process is done.
It's basically done with this code: Code:

if(window.Oby) { window.Oby.registerAjax(["cart.updated","wishlist.updated"],function(params){ ... your javascript code ... } }

You can see an example in the file plugins/hikashop/cartnotify/media/notify.js (for the HikaShop cart notify plugin)

The following user(s) said Thank You: [mabdelaziz](/forum/user/62648-mabdelaziz "View mabdelaziz's Profile")

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

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

Less More

- Posts: 7
- Thank you received: 0
-
-

4 years 10 months ago [\#338013](#338013) by [mabdelaziz](/forum/user/62648-mabdelaziz "View mabdelaziz's Profile")  Replied by *[mabdelaziz](/forum/user/62648-mabdelaziz "View mabdelaziz's Profile")* on topic *[Triggering javascript after add to cart ajax call](/forum/26-product-category-display/871924-triggering-javascript-after-add-to-cart-ajax-call#338013 "-- url of the page with the problem -- :   69.28.90.77/~macautomation/index.php/onl...d06-detachable-chute  -- HikaShop version -- : 3.3.3 -- Joomla version -- : 3.3.3 -- PHP version -- : 5.4.29 -- Browser(s) name and version -- : chrome -- Error-message(debug-mod must be tuned on) -- : None - I want to add some code  I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the  tag of my pages.  Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display. Here's the code I'd like to add: jQuery(&quot;html, body&quot;).animate({ scrollTop: 0 }, &quot;slow&quot;); jQuery(&quot;#hikashop&#95;cart&#95;module&quot;).show();  Could you please let me know the file /line number which I could add this?  Thank you!")*

Thank you, I liked this feature too much.

It will be very helpful to have a page on your developer documentation section.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84NzE5MjQtdHJpZ2dlcmluZy1qYXZhc2NyaXB0LWFmdGVyLWFkZC10by1jYXJ0LWFqYXgtY2FsbD90bXBsPW1hcmtkb3du) 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: 86359
- Thank you received: 14296
-
-

4 years 10 months ago [\#338020](#338020) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Triggering javascript after add to cart ajax call](/forum/26-product-category-display/871924-triggering-javascript-after-add-to-cart-ajax-call#338020 "-- url of the page with the problem -- :   69.28.90.77/~macautomation/index.php/onl...d06-detachable-chute  -- HikaShop version -- : 3.3.3 -- Joomla version -- : 3.3.3 -- PHP version -- : 5.4.29 -- Browser(s) name and version -- : chrome -- Error-message(debug-mod must be tuned on) -- : None - I want to add some code  I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the  tag of my pages.  Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display. Here's the code I'd like to add: jQuery(&quot;html, body&quot;).animate({ scrollTop: 0 }, &quot;slow&quot;); jQuery(&quot;#hikashop&#95;cart&#95;module&quot;).show();  Could you please let me know the file /line number which I could add this?  Thank you!")*

Hi,

It's a good idea. I've worked on that :
[ www.hikashop.com/support/documentation/6...ocumentation.html#js](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#js)

The following user(s) said Thank You: [ButterflyPixel](/forum/user/31098-butterflypixel "View ButterflyPixel's Profile"), [mabdelaziz](/forum/user/62648-mabdelaziz "View mabdelaziz's Profile")

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

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

Less More

- Posts: 7
- Thank you received: 0
-
-

4 years 10 months ago [\#338029](#338029) by [mabdelaziz](/forum/user/62648-mabdelaziz "View mabdelaziz's Profile")  Replied by *[mabdelaziz](/forum/user/62648-mabdelaziz "View mabdelaziz's Profile")* on topic *[Triggering javascript after add to cart ajax call](/forum/26-product-category-display/871924-triggering-javascript-after-add-to-cart-ajax-call#338029 "-- url of the page with the problem -- :   69.28.90.77/~macautomation/index.php/onl...d06-detachable-chute  -- HikaShop version -- : 3.3.3 -- Joomla version -- : 3.3.3 -- PHP version -- : 5.4.29 -- Browser(s) name and version -- : chrome -- Error-message(debug-mod must be tuned on) -- : None - I want to add some code  I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the  tag of my pages.  Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display. Here's the code I'd like to add: jQuery(&quot;html, body&quot;).animate({ scrollTop: 0 }, &quot;slow&quot;); jQuery(&quot;#hikashop&#95;cart&#95;module&quot;).show();  Could you please let me know the file /line number which I could add this?  Thank you!")*

Great!
Thank you for your fantastic work

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

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