commercetools / commercetools-sunrise-java

The next generation shop framework by commercetools
https://demo.commercetools.com
Apache License 2.0
46 stars 35 forks source link

Checkout does not allow to register as a customer #517

Open floriansattler opened 7 years ago

floriansattler commented 7 years ago

Currently checkout process in Sunrise only allows to checkout as a guest or as a registered user. There is no possibility to create a customer account during the checkout process.

schleichardt commented 7 years ago

Where do you want to add the step to register?

If it should be after the payment step, you could override the method https://commercetools.github.io/commercetools-sunrise-java/javadoc/com/commercetools/sunrise/shoppingcart/checkout/payment/SunriseCheckoutPaymentController.html#handleSuccessfulAction-com.commercetools.sunrise.shoppingcart.checkout.payment.CheckoutPaymentFormData-io.sphere.sdk.carts.Cart-io.sphere.sdk.carts.Cart- to redirect to the register page which can be just a normal Play controller or a custom SunriseFrameworkController.

There is also the possibility to integrate this with the checkout address form, so override com.commercetools.sunrise.shoppingcart.checkout.address.SunriseCheckoutAddressController#getFormDataClass to use your form class with a checkbox to register and override com.commercetools.sunrise.shoppingcart.checkout.address.SunriseCheckoutAddressController#doAction to also save the customer.