I am working on custom Magento 2 site development. And I want to add the add to cart button on product view page.
Where there are 3 tabs i.e. Details, Reviews and Accessories/part.
I have created Accessories/Part content in phtml file in tabular format in which last column is "Add to Cart", and in that "Add to cart" button is placed
So, when user click on add to cart button it should add that product to cart
How should I do this functionality? Can anyone help me by which way I can do it.
Best Answer
In your block file
get productlist in view file