Discussions
Get shopping cart of currently logged-in user or on-behalf of user
Hi all,
How can I pick up the current cart of the logged in user?
I have a button on one of the content pages which should ideally pick up the cart ID of the current cart.
I have tried using the parameter userid which returns all carts of the specific user but a bit stuck in how to pick-up the current one.
I can see that the cart created by the user has additional UpdateInformation in which CreatedBy and UpdatedBy are set to the user but would not know how to filter on this one via the endpoint request.
?userid=18052&CreatedBy=18052&UpdatedBy=18502 does not yield any results although there is one. It also does not feel entirely right because there may be another cart instance with both informations set.
Is there a way to get the current shopping cart id of the logged-in or on-behalf-of user with the cart endpoint?
var data = JSON.stringify(false);
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://imistour832.imiscloud.com/api/cart?userid=18052");
xhr.send(data);
Thank you very much for any pointers in the right direction!
Alex