cancel
Showing results for 
Search instead for 
Did you mean: 

Product listing make link to product page not add to cart

Product listing make link to product page not add to cart

Hi, 

We manage a Magento site where in some lists we use both simple and configurable products. 

What we make the button which appears under the price of the product to link to the product page and not to add the product to the cart.

How can we achieve this?

Here is an example:

https://holyboardshop.com/marcas/riviera?___store=holyboardshop_en

Thank you in advance 

1 REPLY

Re: Product listing make link to product page not add to cart

This is line in the template you would need to override in your theme https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Catalog/view/frontend/template...

 

Instead of outputting the product actions, you will want to check if the product has options, and if not then don't show the add to cart and instead link to the product page. 

 

I haven't tested but there's probably still a $_product->hasOptions() function that you can use to test.

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!