cancel
Showing results for 
Search instead for 
Did you mean: 

Adding product to cart via an external link

Adding product to cart via an external link

Hi,

Could you please help me adding product to cart via an external link. i wan to add a product link on ad-words website so customer can click on the link and directly go to magento basket page.

 

Thanks

Mazhar

2 REPLIES

Re: Adding product to cart via an external link

Hi @Bestsleepever!

 

What version of Magento are you on?

 

Since Magento 1.8, it's no longer possible to add a product to the cart via an external link.

 

It may be possible to achieve this with some custom development, please see this answer on the Magento Stack Exchange: 

https://magento.stackexchange.com/questions/37779/i-want-to-use-add-to-cart-via-url-in-magento-1-8-b...

 

Any further questions, let me know Smiley Happy 

Problem solved? Click Accept as Solution!
Follow me on twitter:@RebeccaBrocton | wearejh.com

Re: Adding product to cart via an external link

Hi @Bestsleepever!

 

I think you can do via core php using iframe.

it is just an idea.

create a module and pass the $product object in the phtml file. after that create only "add to cart" like:

$product=Mage::getModel('catalog/product')->load($productId);//load the product by product id
$product=Mage::getModel('catalog/product')->loadByAttribute('sku',$skuNum);//or load the product by sku number
$product=Mage::getModel('catalog/product')->setStoreId($storeId)->loadByAttribute('sku',$skuNum);//or load the product from a given store id
 
$url = Mage::helper('checkout/cart')->getAddUrl($product);
 
<form action = "<?php echo $url;?> ">
<input type='hidden' name="product_id" value="$productId" />
<button type="submit" value="Add to cart" />
</form>
 
You can try with it.

Thanks
Vishal S