Use Checkout
amerta / amerta/theme/components/Checkout/hooks/useCheckout / useCheckout
Function: useCheckout()
useCheckout(
__namedParameters): {cities: {id:string;name:string; }[];deliveryMethods:any[];discount:number;form:UseFormReturn<CheckoutFormValues,any,CheckoutFormValues>;handleCountryChange: (countryId) =>Promise<void>;hasSpecificCities:boolean;loadingDeliveryMethods:boolean;loadingTaxes:boolean;onInvalid: () =>Promise<void>;onSubmit: (values) =>Promise<void>;orderTaxPercentage:number;qualifiesForFree:any;setCart:Dispatch<SetStateAction<CartWithCalculations|null>>;setShowErrorDialog:Dispatch<SetStateAction<boolean>>;setUseShippingAsBilling:Dispatch<SetStateAction<boolean>>;shippingCost:any;showErrorDialog:boolean;subtotal:number;tax:number;taxRates: {code:string;id:string;name:string;rate:number; }[];total:any;useShippingAsBilling:boolean; }
Defined in: amerta/theme/components/Checkout/hooks/useCheckout.tsx:68
Parameters
| Parameter | Type |
| ------ | ------ |
| __namedParameters | UseCheckoutProps |
Returns
{ cities: { id: string; name: string; }[]; deliveryMethods: any[]; discount: number; form: UseFormReturn<CheckoutFormValues, any, CheckoutFormValues>; handleCountryChange: (countryId) => Promise<void>; hasSpecificCities: boolean; loadingDeliveryMethods: boolean; loadingTaxes: boolean; onInvalid: () => Promise<void>; onSubmit: (values) => Promise<void>; orderTaxPercentage: number; qualifiesForFree: any; setCart: Dispatch<SetStateAction<CartWithCalculations | null>>; setShowErrorDialog: Dispatch<SetStateAction<boolean>>; setUseShippingAsBilling: Dispatch<SetStateAction<boolean>>; shippingCost: any; showErrorDialog: boolean; subtotal: number; tax: number; taxRates: { code: string; id: string; name: string; rate: number; }[]; total: any; useShippingAsBilling: boolean; }
cities
cities: {
id:string;name:string; }[]
deliveryMethods
deliveryMethods:
any[]
discount
discount:
number
form
form:
UseFormReturn<CheckoutFormValues,any,CheckoutFormValues>
handleCountryChange()
handleCountryChange: (
countryId) =>Promise<void>
Parameters
| Parameter | Type |
| ------ | ------ |
| countryId | string |
Returns
Promise<void>
hasSpecificCities
hasSpecificCities:
boolean
loadingDeliveryMethods
loadingDeliveryMethods:
boolean
loadingTaxes
loadingTaxes:
boolean
onInvalid()
onInvalid: () =>
Promise<void>
Returns
Promise<void>
onSubmit()
onSubmit: (
values) =>Promise<void>
Parameters
| Parameter | Type |
| ------ | ------ |
| values | CheckoutFormValues |
Returns
Promise<void>
orderTaxPercentage
orderTaxPercentage:
number
qualifiesForFree
qualifiesForFree:
any
setCart
setCart:
Dispatch<SetStateAction<CartWithCalculations|null>>
setShowErrorDialog
setShowErrorDialog:
Dispatch<SetStateAction<boolean>>
setUseShippingAsBilling
setUseShippingAsBilling:
Dispatch<SetStateAction<boolean>>
shippingCost
shippingCost:
any
showErrorDialog
showErrorDialog:
boolean
subtotal
subtotal:
number
tax
tax:
number
taxRates
taxRates: {
code:string;id:string;name:string;rate:number; }[]
total
total:
any=safeTotal
useShippingAsBilling
useShippingAsBilling:
boolean