Vote up!
Vote down!

How do I fetch visitors cart contents, using services api?

I need to add a counter to a link to "view cart" - to show how many items are in the users cart.

I would like to be able to cache all pages, except "cart view" and /checkout/* - using varnish.

So I would like to fetch this counter of items in users cart - using services API.

However, I'm not sure how. I would need to call using some ajax code - which would also send sessionid along in the call - so the services implementation ( I was thinking of using services-3.x module) can see which users cart it's suppose to fetch data from.

I have found commerce_ajax_cart module - but I only want a counter - so I figure it's not covering this (since it "just" works with the cart block, generated from a view).

Any hints would be very much appreciated.

Asked by: klavs
on July 5, 2012

1 Answer