...
Adjust the openUpsellModal to handle a new path of logic
The idea is to keep the default behavior if the new logic is not enabled in Sanity: show the modal for any type of item
Create new functions to isolate the new logic (they can also be in a utils file, for example)
Function for the new variation logic (which will change the trigger behavior)
Functions to serve as utilities (for example, to know if the item is Combo/Picker)
Check the
newCartEntries
to be able to identify if the added item is a typePicker
orCombo
We can use Sanity to hold the logic that will change the upsell modal trigger behavior (more details at https://rbictg.atlassian.net/wiki/spaces/IBC/pages/edit-v2/4940922909#Sanity-to-hold-the-new-trigger-behavior-configuration below)
The code below can exemplify how things will be. Of course, this is just an example and will not represent the final solution.
...