The data model allows to create a cart without a customer, but the API requires a customer. Why is that? It was introduced in https://github.com/Sylius/Sylius/commit/b436a680056713289c6a55de80c33988c255c451#diff-455d94adb41079888103c5229c1e8384R56
Maybe @lchrusciel can shed some light on this? I could create a PR if necessary.
Thanks!
The data model allows to create a Cart without a customer, but the order has to have a customer assigned. As cart endpoints allow to process an order from Admin perspective it was required to add a customer to the cart at the during creation action. Remember, that this is not a ShopAPI.
But while the order is in the cart state, the customer can be null? I'd expect a validator (or sth. else) to make sure that the order has a customer if I try to continue with the cart, but while it's just a cart I should be able to update its customer via PATCH in my opinion.
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.
Still nice to have
@venyii https://github.com/Sylius/SyliusShopApiPlugin might be a solution here :)
Yep I know the repo, but I had to start with something while it didn't exist yet for quite some time and the admin api was the only thing readily available. One does not simply migrate (a _now_ huge project) 😄
If you really don't see this behaviour in the admin api, be my guest to close this and I'll have to live with it until I figure it out and fix it myself ⏳. Just didn't want to let the issue be buried.
Customer email can be added to the last step of checkout. If logged in, then just assign a logged user email. Otherwise, it has to be sent with the complete request
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.
When Sylius is acting as "headless framework" this should be possible, or am I wrong?
Hello Patrick,
you are able to create a cart without the customer, but you need to either provide your custom validation/logic or use ShopApiPlugin. It is not supported out-of-the-box by AdminAPI
Thanks for the response.
Is it possible to get this into the core?
In the nearest future for sure no, we're exploring many possibilities for Sylius evolution for 2.0 and further versions, so maybe someday 🚀 But this plugin is easy to install and configure, why not give it a try? :)
It's not that easy to install and one more dependency for our plugin.
When Sylius is just an service which has no connection to the user (browser), then I think everything should be possible to handle via the Admin REST API, or am I wrong?
It all is possible, here we have just constraint on the form. Change of this behavior should be pretty easy, though you have to ensure, that you won't be able to complete checkout without a customer.
Most helpful comment
But while the order is in the
cartstate, the customer can benull? I'd expect a validator (or sth. else) to make sure that the order has a customer if I try to continue with the cart, but while it's just a cart I should be able to update its customer viaPATCHin my opinion.