Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Load ajax cart on page load not on click of open cart drawer #558

Open
mdunbavan opened this issue Jul 21, 2016 · 4 comments
Open

Load ajax cart on page load not on click of open cart drawer #558

mdunbavan opened this issue Jul 21, 2016 · 4 comments

Comments

@mdunbavan
Copy link

Hi,

I am trying to look at the best solution to loading the cart template into a container when the page loads as opposed to when click on open cart drawer.

Are there any options or solutions for this?

@Cam
Copy link

Cam commented Jul 22, 2016

I am not sure it would be a good idea to do that. But you certainly could. You would need to modify the following files to suit: ajax-cart.js.liquid, ajax-cart-template.liquid and modify the script at the bottom of the theme.liquid layout file so that "timber.RightDrawer.open();" updates your inline cart instead.

@sydneykaiserman
Copy link

@Cam, thank you for chiming in! I looked all over the internet for this. Essentially, loading ajax cart on page load (rather than on open cart drawer) allows a user to view the items in the cart without having to click on anything. I am working on a very common implementation that will show the ajaxified cart in a drop down menu that just fades in when hovering the Cart link, rather than clicking on a link to display the cart. The problem I am having is the same as that the DOM is not populated with the ajaxified cart until the cart button is clicked on. How does one instantiates the ajax cart without the toggle cart button?

(The suggested workaround shown on this thread: #265 seems very simple but I could not make it work - and the link from Carson no longer works.)

@mdunbavan, where you able to find a way to create the ajaxified cart on load?

@MatthewKennedy
Copy link

I'm looking to do the same, load cart on page load, any ideas? @sydneykaiserman did you manage to do this and how?

@alonsoh
Copy link

alonsoh commented Sep 24, 2017

@MatthewKennedy I was able to do it by calling this in the page load:

ajaxCart.load();
timber.RightDrawer.open()

Hope it helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants