Difference between revisions of "Same as shipping logic"
m (→Prerequisites) |
|||
| Line 12: | Line 12: | ||
==== 2. Logged-in checkout ==== | ==== 2. Logged-in checkout ==== | ||
In this scenario the customer has two options: ''Add a new address'' and ''List previously saved addresses''. With ''Add a new address'' a new Recipient / Sender is created in db and linked to the Checkout. When picking a ''previously saved address'' a different Recipient / Sender is linked to the Checkout. | In this scenario the customer has two options: '''Add a new address''' and '''List previously saved addresses'''. | ||
* With '''Add a new address''' a new Recipient / Sender is created in db and linked to the Checkout. | |||
* When picking a '''previously saved address''' a different Recipient / Sender is linked to the Checkout. | |||
== The "Same As Shipping" workflow == | == The "Same As Shipping" workflow == | ||
Revision as of 10:38, 20 February 2022
Prerequisites
The Recipient and Sender are linked to a User, if any. A user may have more than one Recipient / Sender. Why this is important? In the checkout process there are two scenarios:
- Guest checkout
- Logged-in checkout
1. Guest checkout
In this scenario when editing the Recipient / Sender details they are always overwritten. In other words, a Guest checkout will have one Recipient and one Sender object. These Recipient and Sender are not linked to a User.
2. Logged-in checkout
In this scenario the customer has two options: Add a new address and List previously saved addresses.
- With Add a new address a new Recipient / Sender is created in db and linked to the Checkout.
- When picking a previously saved address a different Recipient / Sender is linked to the Checkout.
The "Same As Shipping" workflow
When choosing the Billing Address (Sender) the Customer has 2 options:
- Same as shipping address
- Add new billing address
Same as shipping address
With this no Sender is created in db, but a flag is marked. As a result upon checkout completion a Sender will be created and attached to the Order.
NOTE: Recipient fields must match Sender's. Results that Recipient must have Company and Company VAT fields.
Add new billing address
In this case the same_as_shipping flag is set to false (0) and a new Sender is created and added to the Checkout.