...
Task 1: Add a new toggle to show the addOn section as cart items and add service modes selection
...
Motivation: the toggle
Toggle: this will help us on the FE logic to show in the cart (as cart items) only sections that have this toggle set as TRUE. Besides that, we’ll need to give to the user the power to choose in what service mode they want to show the items. If nothing is selected the section items will be available for all service modes.
Service modes: for this feature, the client wants to show the bag only for Mobile Ordering types. To make a flexible solution will add this on Sanity and the brand can choose what wanted.
For the field “Show section items in cart”:
...
Only sections with
showSectionItemsOnCart
= TRUE on Sanity should be shown in the cartThis will not remove the item from the original “+ Add extras” feature
If the feature flag is OFF all the feature features will be OFF
If the user did not select any service mode on Sanity we’ll show the section and item for all the available service modes. If the user selects one or more service modes on Sanity we’ll only show the feature for that options
For the “Bag with Handles” feature we’ll show only for “Mobile Ordering” but as this feature is generic we can just configure this on Sanity
The item should have the same style as the Upsell feature (title and button styles)
When we click to add an item the item should be sent to the “Your cart” section with 1x in the quantity and after that should not be shown in the cart as an item as before
If we click on the “remove” button on the added item in the “Your cart” section the item should be removed from the “Your cart” section and appear again in the cart section
If the section has only one item remaining the entire section should be hidden/removed from the screen
If the rendered section has only one item the visual should be as described above on task 4. If have more than one item the items should be presented horizontally with a scroll as the upsell feature
For this new feature, we are using a good part of the “AddOn” feature which means:
We don't need to deal with item updates after adding the first time on the cart. Your only objective here is to add the first item successfully)
We can’t edit directly the item quantity (as in the upselll feature) because of the way that the “AddOn” feature works. The items will be considered “extra items” by the application and to be able to edit the item we need to click on the “edit” button and change the quantity in the extra modal
All the logic for the “reordering”, “receipt”, “receipt email”, and etc, are already implemented by the “AddOn” feature… we're getting it for free 😃