Setting the file. One moment.
Subchapter 1.44
references/context-provider/vertical-contexts/bookings/service-addons.mdMarkdown2 KBView on GitHub
@wix/bookings/context/service-addonsRead Importing a Context in Code first. Import only the hook, from .
@wix/bookings/context/service-addonsLoads the add-ons offered for the service in the surrounding ServiceContextProvider, and reads and changes the visitor’s picks stored there.
import { ServiceAddOnsContextProvider } from '@wix/bookings/context/service-addons';__0: ServiceAddOnsContextProviderPropsElementReads the service add-ons state; throws when no ServiceAddOnsContextProvider is above.
import { useServiceAddOnsContext } from '@wix/bookings/context/service-addons';ServiceAddOnsContextValue| Property | Type | Description |
|---|---|---|
children | ReactNode |
| Property | Type | Description |
|---|---|---|
addOnGroups | AddOnGroupItem[] | |
selected | AddOn$1[] | Only picks the catalog offers. |
isLoading | boolean | |
hasError | boolean | |
toggleAddOn | (addOnId: string) => void | No-op turning on when its group (the first offering it) is at maxNumberOfAddOns. |
setAddOnQuantity | (addOnId: string, quantity: number) => void | Clamped to [0, maxQuantity]; 0 removes it. |
| Property | Type | Description |
|---|---|---|
groupId | string | null | |
groupName | string | null | |
prompt | string | null | |
maxNumberOfAddOns | number | null | Max distinct add-ons, not units. |
addOns | AddOnItem[] | |
selectedCount | number | |
canSelectMore | boolean |
| Property | Type | Description |
|---|---|---|
id | string | |
quantity | number |