cancel
Showing results for 
Search instead for 
Did you mean: 

How to display related products after adding a item to cart.

SOLVED

How to display related products after adding a item to cart.

In the template I am using, once you add an item to the cart a popup displays that says "you have added *PRODUCT* to your cart!" I want to show that products related products in this pop up with it. Can someone help me out? Im new to magento.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to display related products after adding a item to cart.

@brett_nelson you can use the below block and use the "getItems()" for getting the collection of related products.

 

Block :- \Magento\Catalog\Block\Product\ProductList\Related

 

Thanks

View solution in original post

4 REPLIES 4

Re: How to display related products after adding a item to cart.

Hello @brett_nelson 

If your theme is doesn't have that functionality and if you don't know how to customize, then i would suggest to use the extension.

https://www.tigren.com/magento-2-extensions/magento-2-ajax-add-to-cart/

https://bsscommerce.com/magento-2-ajax-add-to-cart-extension.html

 

 

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

Re: How to display related products after adding a item to cart.

I would prefer to code it myself. I already have the functionality of adding everything to my cart. However I just need to be able to access that products information and I will be able to take care of the rest.

 

thanks

Re: How to display related products after adding a item to cart.

@brett_nelson you can use the below block and use the "getItems()" for getting the collection of related products.

 

Block :- \Magento\Catalog\Block\Product\ProductList\Related

 

Thanks

Re: How to display related products after adding a item to cart.

Is it possible to have more details ?

Thanks