Home » Magento18 November 2013

Magento: Get Add to Cart URL of any Product

Here is a quick code to get add to cart url of any product.

Suppose that we are fetching add to cart url of a product with id ‘166’.

Hope it helps. Thanks.


Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Ashish Joshi

    Thanks A lot For this help..

  • hemaxi

    thanks . is works great .but how can I give product id dynamically..!!??
    I want to show sub product dropdown of configure product in list.phtml page.I try this code .It works but how can I pass subproduct id that selected from dropdown means in list.phtml page how to get selected value of dropdown ?? plz give any solution.. Thanks..

  • Afzal Khan

    Hello there.. I have a question
    The question is that I have a searchbox when I type a product name into searchbox it fetches the result from database now i want that when i click that product it shows me the details of that product
    how can i get the url of that product?

  • Jignesh Prajapati

    This is work for me but only in firefox not in google chrome.
    Please suggest me something for the same.