Pass cart data with outgoing ember-data requests


#1

I’m prototyping a shopping cart app that has alot of dynamic pricing (calculated by the API). Some of the pricing for items is determined by what items are already in the cart. For example, group discounts like “buy any 3 of this set of items and get 10% off each”. There are a bunch more.

So for prices to appear correctly throughout the app, I need to send the cart contents (if they exist) to the API with every request that returns product info/prices. Otherwise I’ll need to keep a session containing the cart on the API. I am doing that now and it’s working, but it doesn’t make sense to keep the cart on both the client and the server (and I guess a proper REST API doesn’t do that).

I’m not quite sure how to approach, especially since most of my ember-data requests that return product data are GET requests.

Maybe serialize the cart SKUs into the URL of the GET requests? That might work, I’m just wondering if there’s a better way.

Any help appreciated. Thanks!