0

I need to give the customers the possibility to have more than one cart, and I am not able to find a way to retrieve all the carts related to a given customer. I'm creating carts with this name structure: "[p]cart[userid]storefront", where p is a progressive number. Then I tried to retrieve all the carts which names end with "cart[userid]storefront", but it's not working at all. I tried:

http://{{ServiceHost}}/{{ShopsApi}}/Carts/?$filter=endswith(Name,'cart[userid]storefront') http://{{ServiceHost}}/{{ShopsApi}}/Carts/?$filter=endswith(Name,'cart[userid]storefront') eq true http://{{ServiceHost}}/{{ShopsApi}}/Carts/?$filter=endswith(Id,'cart[userid]storefront') http://{{ServiceHost}}/{{ShopsApi}}/Carts/?$filter=endswith(Id'cart[userid]storefront') eq true

But all of them gave 500 internal server error. Could you give me some hint on how to achieve this result or tell me why this ODATA Services are not working correctly?

thank you

1

Sitecore Experience Commerce doesn't implement full OData funtionality, the philosophy was not to provide an API for complex sorting and filtering. It's purpose was to provide a simple API for traversing lists of entities and getting specific entities.

What you want shouldn't be too hard to achieve though. Your best solution would be to implement a custom Controller, Command & Pipeline to achieve this. You could look into how the IGetCartPipeline functions and leverage this to return the list of carts you require

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.