1

I am having difficulty moving the user's cart over to being an order. I understand that a cart is essentially an order with isCompleted set to false and no date set but I can't seem to access anything when setting orders = craft.commerce.orders, etc. I can see the cart on the backend along with the guest's email but cannot get orders. I can easily get the current cart and all my products have a price of $0 if that is relevant.

Thanks!

  • 1
    Is this in the context of a plugin (PHP) or the front-end (Twig)? Can you provide some relevant template/PHP code to show what you're currently doing? – Brad Bell Sep 26 '16 at 18:55
  • This is using twig. Currently I'm using {% set cart = craft.commerce.cart %} and then successfully adding to it through my product pages using a POST for /updateCart. After the user has added all the items he/she wants then I want them to be able to checkout... or at least move to a different order status so I can have an email sent. – William Shanks Sep 27 '16 at 14:00
1

craft.commerce.orders returns an element criteria model that defaults to setting the criteria param isCompleted to true.

You would need to set isCompleted to false on the criteria to override it, in order to get someone else's cart from the front-end.

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.