cancel
Showing results for 
Search instead for 
Did you mean: 

Sticky Add to Cart

Sticky Add to Cart

I'm trying to figure out how to create a sticky add to cart widget that would go into a right side block (if that's the way to do it).

 

You can see what I mean by sticky add to cart by going to:

https://amasty.com/improved-layered-navigation-for-magento-2.html or any other of their product pages. On the right side you see the add to cart section and if you scroll down reading about the product you see that the add to cart section follows you down the page.

 

How would I go about doing that? I think its a great solution to have your shoppers have the ability to add a product to cart at all times on a particular product page.

 

Thanks for any suggestions.

2 REPLIES

Re: Sticky Add to Cart

@jackkros

You'd need to write custom css for that. Follow the guide here: https://jsfiddle.net/livibetter/HV9HM/ 

 

Secondly, apply the css class using htmlClass="your-css-class" to the right side container. i.e. 

 

<container name="some.container" as="someContainer" label="Some Container" htmlTag="div" htmlClass="your-css-class" />

More details: https://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-manage.html 

Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post

Re: Sticky Add to Cart

@ShoaibRehman89 Thank you for the info. 

Would you know, how to call the shopping cart buttons and options into the container?