Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Plans for ajax cart? #132

Closed
yangkennyk opened this issue Apr 21, 2017 · 13 comments
Closed

Plans for ajax cart? #132

yangkennyk opened this issue Apr 21, 2017 · 13 comments
Assignees
Labels

Comments

@yangkennyk
Copy link

yangkennyk commented Apr 21, 2017

Are there any plans on adding an ajax cart option as part of slate? specifically with ajax cart drawer functionality.

I'm in the middle of developing a theme right now with slate and porting over the ajax cart code from https://shopify.github.io/Timber/ .

Since timber is no longer being maintained, will my theme's ajax cart functionality possibly experience issues in the future?

@ptcampbell
Copy link

+1 with this one. I think the Ajax cart itself could do with simplifying too.

@t-kelly t-kelly self-assigned this May 1, 2017
@t-kelly
Copy link
Contributor

t-kelly commented May 1, 2017

Are there any plans on adding an ajax cart option as part of slate? specifically with ajax cart drawer functionality.

One of the goals of Slate is to focus on being an unopinionated starting point for developers. Timber was a starting point but was also was very opinionated about how it approached particular problems. Ultimately, this limited Timber's usefulness to developers who wanted to do things differently.

The problem with including AJAX Cart Drawer code (Liquid, CSS, and JS) inside Slate is that it would be a single, opinionated approach to a problem with tons of different solutions. Just look at the AJAX Cart Drawer in Brooklyn vs. Boundless vs. Narrative themes. They all try to solve the same problem, but do so in very different ways.

We are currently working on expanding cart.js so that it has more helpful functions like cart.addItem(), cart.changeItem(), etc. The functions included in this file should make creating an AJAX cart a lot easier, while not being opinionated on how the Liquid and CSS is written. Hoping to have a PR open in the near future.

We are interested in exploring the best way to share helpful theme code (Liquid, CSS, and JS) like the AJAX Cart Drawer found in Timber, but do not feel that it's home should be inside of Slate. Any ideas and opinions on how this could be best done would be more then welcome 😄

Since timber is no longer being maintained, will my theme's ajax cart functionality possibly experience issues in the future?

The Timber AJAX Cart uses the Cart API. At Shopify, we always prioritize improving the platform without breaking backwards compatibility, so the Timber cart should continue to work just fine.

I think the Ajax cart itself could do with simplifying too.

@ptcampbell are you referring to the Cart API docs. If so, we totally agree and would like to improve and simplify them.

If you are referring to the the Liquid, CSS, and JS which make up the Timber AJAX Cart Drawer then we totally agree with that too! This is exactly why we need to let opinionated approaches to problems live in a separately so that they can grow and improve.

@t-kelly t-kelly closed this as completed May 1, 2017
@ptcampbell
Copy link

Hey, thanks for the response. I am happy to continue using Timber's cart.js for now.

For what it's worth, I think that Slate is still too opinionated on the styling side of things. For example, I don't think we need to get into the business of determining breakpoints, variables, mixins etc. I would always do that myself. So I ended up removing most of the imported stylesheets.

Thanks!

@t-kelly
Copy link
Contributor

t-kelly commented May 1, 2017

Thanks for the feedback @ptcampbell!

@NathanPJF
Copy link
Contributor

For what it's worth, I think that Slate is still too opinionated on the styling side of things. For example, I don't think we need to get into the business of determining breakpoints, variables, mixins etc.

You're welcome to change those files (grid.scss, variables.scss) as you see fit @ptcampbell. grid.scss generates class names like .grid__item and .medium-up--one-half, but those classes are nowhere in the markup of the template files. There's no expectation that you'll use our grid system, so you can easily swap it for your prefered one without having to remove class names in the HTML.

@ckizer
Copy link

ckizer commented Sep 14, 2017

Cart.js is way to complicated for most developers to spin up their own ajax cart. Why can't the timber shopping cart be included into this project? It's frustrating to see Abandoned projects like timber. I'd love to use slate, but I don't want to spend months developing a custom ajax cart which a requirement of any shopify theme.

At the very least you can provide clean instructions for copying timber ajax cart into the slate theme and having it work?

Thank you.

@t-kelly
Copy link
Contributor

t-kelly commented Sep 14, 2017

@ckizer thanks for your feedback! We are exploring ways of including 'learning by example' materials in the next version of Slate. This would be a good example to have.

@ckizer
Copy link

ckizer commented Sep 14, 2017 via email

@t-kelly
Copy link
Contributor

t-kelly commented Sep 15, 2017

Timber is open source so all the code you need is there. There is nothing special about the code that would stop it from working in Slate. It will just take time to identify what code is needed, copy it over, and get things working smoothly.

You're welcome to fork Slate and give it a shot! Like I said before, there is a chance we will explore this in the future as an example -- but when that will happen is still to be determined.

@leofrozenyogurt
Copy link

Dropping in on this almost a year later. We are trying to bring in the the ajax-cart functionality but there seem to be way too many hiccups in getting it ported over. Has anyone on the slate team had any luck with it?

@rg-najera
Copy link

Not from the slate team but I used Cart.js on OrientWatchUSA.com and it worked really nicely. Also, the Cart.js documentation provides support for rivetts which is a small DOM manipulation library for updating amounts directly on the cart slide out we created. For the panel, we simply used a tweening library to animate the different states. All in all it took us less than a few hours to set it up and getting working. It will do all of the Ajax handling and callbacks with a few lines of js.

@iamkevingreen
Copy link

@yangkennyk I ported much of the timber ajax cart into a mini api that makes building an ajax cart relatively easy! https://github.com/the-couch/richer would love some support on extending it further but it's served my needs thus far.

@lock
Copy link

lock bot commented Oct 26, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants