...
Base interface:
Code Block language typescript { title: 'Show section items in cart', description: 'All the items from this section will be available directly in the cart. The section name will be the header title', name: 'showSectionItemsOnCart', type: 'boolean', initialValue: false, hidden: () => ctx.isUS validation: ... }
The
hidden
key will be important to not show the toggle for the US marketUse the validation field and add logic to show an error in Sanity if this the toggle is false but has some service mode selectedON but the user doesn’t select any mode
For the “Service Modes” toggles:
...
Code Block | ||
---|---|---|
| ||
{
title: 'Service Modes',
description:
'If the the toggle "show section items in cart" is ON you need to select at least one service mode.',
name: 'sectionItemsServiceModes',
type: 'object',
fields: [
{
title: 'Pick Up',
name: 'pickUpServiceMode',
type: 'boolean',
},
... and so on
],
validation: ...,
hidden: hideIfNoShowSectionItemsOnCart,
} |
...