cancel
Showing results for 
Search instead for 
Did you mean: 

Buy now / Add To Cart Button Open in External Link attribute

Buy now / Add To Cart Button Open in External Link attribute

How can I get this done? maybe many of you already know how to do it. You can see the picture.

Goal:

  • Allow all products to have a field called "External Link" here I can set a link.
  • if the link is empty the products act normal, and if someone clicks "buy now" the product is added to cart. 
  • if the External Link field is filled with a link. then when the person clicks Buy now button instead of adding the product to the cart, it just open the link.
  • That's it. I created the attribute but idk how to make this functionality. Smiley Sad help!

LINK.png

3 REPLIES 3

Re: Buy now / Add To Cart Button Open in External Link attribute

@starlyns  you can override the file of product view.

 

In that you can check if this attribute has value.

If yes you can create a new button with Buy Now text with your external link else the original buy now button will be there.

 

Thanks

Re: Buy now / Add To Cart Button Open in External Link attribute

How do I do this?

Re: Buy now / Add To Cart Button Open in External Link attribute

@starlyns Sorry for late reply.

 

You can check the file from where you are getting the add to cart button.

For this just enable the profiler and check the template path.

 

When you finds the file there you can just add the condition if this attibute has value then show another button with this value else show add to cart button.

 

Let me know if you stuck anywhere.

 

Thanks