...
All the solution is based on the AddOn (add extras items) that already exists in the Whitelabel code! To make this work for our case will develop a generic feature that is based on some parts of the “Add extra” feature. We’ll use the useFeatureMenuAddOn
and the useCartAddOns
to make it easy and reduce the complexity of dealing with the cart orchestration:
The UI for the item in the cart will be equal to the “Add to Order” (upsell feature):
We’ll use the AddOn document from Sanity and add a new toggle and object block (for service modes). This will make our feature generic and independent from the bag solution:
With this suggestion of implementation, we’re getting free all the order flow:
Receipt already implemented for extra items:
The implementation for the added extra item to the “Your cart” section
A modal to edit the extra item
The item added to the cart on the home page
The original “Add extra” feature working (that will give us what was shown above for free:
...