Forum
Fetch current Cart ID
Hi!
I would like to be able to retrieve the current cart ID, is there any native perch function for that? From what I saw, the perch_shop_cart doesn't return the id of the current cart neither any of the other native functions . In my case, I need the id to pass it to a webservice that uses the perchDB API "get_rows" and fetches extra information for a given cart.
Hope you can help
I ended up finding a solution, basically I fetch the current user ID and then use that id to find the most recent cart ID for that user in particular. For anyone looking for a way to do that here it is an example:
I also ended up adding a new function to perch shop, the example that I provided earlier only works if the user already has an id associated to him. Because of that, I added the following code to perch/addons/apps/perch_shop/lib/PerchShop_Runtime.php
and perch/addons/apps/perch_shop/runtime/cart.php
Now I can just call