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

#   Add to Cart button by passing product ID in HTML / JavaScript code?

##

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

Less More

- Posts: 11
- Thank you received: 0
-
-

10 years 1 week ago [\#255337](#255337) by [arkscan](/forum/user/45684-arkscan "View arkscan's Profile")  *[  Free                        ](/forum/30-integrations/887504-add-to-cart-button-by-passing-product-id-in-html-javascript-code#255337 "I know how to create an 'Add to Cart' button on an article by simply passing in the product ID, such as '&lt;div id=")*

'. Since I don't have an option to create a..." class="hasTooltip topictitle"&gt;Add to Cart button by passing product ID in HTML / JavaScript code? was created by *[arkscan](/forum/user/45684-arkscan "View arkscan's Profile")*

I know how to create an 'Add to Cart' button on an article by simply passing in the product ID, such as '  Free

'. Since I don't have an option to create a button on article, but I believe we can use custom HTML &amp; Javascript to create a 'Add to Cart' button, would please let me know if there is solution to do that?

If there is no solution, what about via PHP coding in a custom php module? is there a way to do so? Any direction on how to do it will be appreciated.

thank you!

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

10 years 1 week ago [\#255358](#255358) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[  Free                        ](/forum/30-integrations/887504-add-to-cart-button-by-passing-product-id-in-html-javascript-code#255358 "I know how to create an 'Add to Cart' button on an article by simply passing in the product ID, such as '&lt;div id=")*

'. Since I don't have an option to create a..." class="hasTooltip topictitle"&gt;Add to Cart button by passing product ID in HTML / JavaScript code?

Hi,

When you edit a product in your HikaShop backend, you can find the "HTML add to cart button" button at the top. If you click on it, you'll get a popup with some HTML you can use to get an add to cart button for that product that you can paste anywhere on your website. It's however less flexible than the content tag system as it doesn't have any options.

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

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

Less More

- Posts: 11
- Thank you received: 0
-
-

10 years 1 week ago -  10 years 1 week ago [\#255426](#255426) by [arkscan](/forum/user/45684-arkscan "View arkscan's Profile")  Replied by *[arkscan](/forum/user/45684-arkscan "View arkscan's Profile")* on topic *[  Free                        ](/forum/30-integrations/887504-add-to-cart-button-by-passing-product-id-in-html-javascript-code#255426 "I know how to create an 'Add to Cart' button on an article by simply passing in the product ID, such as '&lt;div id=")*

'. Since I don't have an option to create a..." class="hasTooltip topictitle"&gt;Add to Cart button by passing product ID in HTML / JavaScript code?

[ ![hikashop.png](/forum/attachment/34674) ](/forum/attachment/34674 "hikashop.png")

- [ ![hikashop.png](/forum/attachment/34674) ](/forum/attachment/34674 "hikashop.png") [ ](/forum/attachment/34674?download=1 "hikashop.png")

Last edit: 10 years 1 week ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile").

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

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

Less More

- Posts: 11
- Thank you received: 0
-
-

10 years 1 week ago [\#255427](#255427) by [arkscan](/forum/user/45684-arkscan "View arkscan's Profile")  Replied by *[arkscan](/forum/user/45684-arkscan "View arkscan's Profile")* on topic *[  Free                        ](/forum/30-integrations/887504-add-to-cart-button-by-passing-product-id-in-html-javascript-code#255427 "I know how to create an 'Add to Cart' button on an article by simply passing in the product ID, such as '&lt;div id=")*

'. Since I don't have an option to create a..." class="hasTooltip topictitle"&gt;Add to Cart button by passing product ID in HTML / JavaScript code?

I don't see "HTML add to cart button", am I in a wrong version of Hikashop? I see 'Add to cat HTML link', here is what I got

&lt;a class="hikashop_html_add_to_cart_link" href="http://127.0.0.3/index.php?option=com_hikashop&amp;ctrl=product&amp;task=updatecart&amp;quantity=1&amp;checkout=1&amp;product_id=1"&gt;Add to cart&lt;/a&gt;

What I want:
1. A button instead of a link.
2. the Add to cart link overwrite the existing quantity, if I have a quantity of 3 for this item, and after it's 'added' (actually it's updated to), it will become one, I would expect it becomes 4, is it possible?

thank you

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

10 years 1 week ago [\#255458](#255458) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[  Free                        ](/forum/30-integrations/887504-add-to-cart-button-by-passing-product-id-in-html-javascript-code#255458 "I know how to create an 'Add to Cart' button on an article by simply passing in the product ID, such as '&lt;div id=")*

'. Since I don't have an option to create a..." class="hasTooltip topictitle"&gt;Add to Cart button by passing product ID in HTML / JavaScript code?

Hi,

Yes, I meant 'Add to cat HTML link'.
You can do that by changing slightly the code to: Code:

&lt;a class="hikashop_html_add_to_cart_link btn" href="http://127.0.0.3/index.php?option=com_hikashop&amp;ctrl=product&amp;task=updatecart&amp;quantity=1&amp;checkout=1&amp;add=1&amp;product_id=1"&gt;Add to cart&lt;/a&gt;

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