Search...
updateCheckoutSettings( )
Developer Preview
Updates the sites' checkout settings.
Description
The updateCheckoutSettings()
function returns a Promise that resolves to the newly updated checkout settings.
Admin Method
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function updateCheckoutSettings(checkoutSettings: CheckoutSettings): Promise<UpdateCheckoutSettingsResponse>
updateCheckoutSettings Parameters
NAME
TYPE
DESCRIPTION
checkoutSettings
CheckoutSettings
Checkout settings to update.
Returns
The updated checkout settings.
Return Type:
Promise<
UpdateCheckoutSettingsResponse
>NAME
TYPE
DESCRIPTION
checkoutSettings
CheckoutSettings
The updated checkout settings.
Was this helpful?
Update checkout settings (dashboard page code)
Copy Code
1import { checkoutSettings } from 'wix-ecom-backend';23/* Sample update value:4{5 "checkoutSettingsInfo": {6 "checkoutFields": {7 "mitEnabled": false8 }9 }10}11*/1213export async function myUpdateCheckoutSettingsFunction(checkoutSettingsInfo) {14 try {15 const settings = await checkoutSettings.updateCheckoutSettings(checkoutSettingsInfo);16 console.log('Success! Updated checkout settings:', settings);17 return settings;18 } catch (error) {19 console.error(error);20 // Handle the error21 }22}2324/* Promise resolves to:25{26 "checkoutSettings": {27 "checkoutPolicies": {28 "termsAndConditions": {29 "visible": true,30 "content": "All product listings, prices, and specifications are subject to change without notice. ACCS reserves the right to modify or discontinue products at any time."31 },32 "privacyPolicy": {33 "visible": true,34 "content": "Your privacy is important to us. Please review our Privacy Policy to understand how we collect, use, and disclose information."35 },36 "returnPolicy": {37 "visible": true,38 "content": "Please refer to our Return Policy page for information on returns and refunds. ACCS reserves the right to refuse returns that do not meet our policy criteria."39 },40 "digitalItemPolicy": {41 "visible": false,42 "content": ""43 },44 "contactUs": {45 "visible": true,46 "content": "Email: accs@mail.com"47 },48 "customPolicy": {49 "visible": true,50 "content": "Placing an order on our website constitutes an offer to purchase the products. We reserve the right to refuse or cancel any order for any reason. Payment must be received before order processing.",51 "title": "Orders and Payments"52 }53 },54 "checkoutFields": {55 "subscriptionCheckbox": {56 "visible": true,57 "checkedByDefault": false58 },59 "policyAgreementCheckbox": {60 "visible": true,61 "checkedByDefault": false62 },63 "giftCardRedeemEnabled": true,64 "mitEnabled": false65 }66 }67}68*/69
Update checkout settings (export from backend code)
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { checkoutSettings } from 'wix-ecom-backend';3import { elevate } from 'wix-auth';45/* Sample update value:6{7 "checkoutSettingsInfo": {8 "checkoutFields": {9 "mitEnabled": false10 }11 }12}13*/1415export const myUpdateCheckoutSettingsFunction = webMethod(Permissions.Admin, async (checkoutSettingsInfo) => {16 try {17 const elevatedUpdateCheckoutSettings = elevate(checkoutSettings.updateCheckoutSettings);18 const settings = await elevatedUpdateCheckoutSettings(checkoutSettingsInfo);19 console.log('Success! Updated checkout settings:', settings);20 return settings;21 } catch (error) {22 console.error(error);23 // Handle the error24 }25});2627/* Promise resolves to:28{29 "checkoutSettings": {30 "checkoutPolicies": {31 "termsAndConditions": {32 "visible": true,33 "content": "All product listings, prices, and specifications are subject to change without notice. ACCS reserves the right to modify or discontinue products at any time."34 },35 "privacyPolicy": {36 "visible": true,37 "content": "Your privacy is important to us. Please review our Privacy Policy to understand how we collect, use, and disclose information."38 },39 "returnPolicy": {40 "visible": true,41 "content": "Please refer to our Return Policy page for information on returns and refunds. ACCS reserves the right to refuse returns that do not meet our policy criteria."42 },43 "digitalItemPolicy": {44 "visible": false,45 "content": ""46 },47 "contactUs": {48 "visible": true,49 "content": "Email: accs@mail.com"50 },51 "customPolicy": {52 "visible": true,53 "content": "Placing an order on our website constitutes an offer to purchase the products. We reserve the right to refuse or cancel any order for any reason. Payment must be received before order processing.",54 "title": "Orders and Payments"55 }56 },57 "checkoutFields": {58 "subscriptionCheckbox": {59 "visible": true,60 "checkedByDefault": false61 },62 "policyAgreementCheckbox": {63 "visible": true,64 "checkedByDefault": false65 },66 "giftCardRedeemEnabled": true,67 "mitEnabled": false68 }69 }70}71*/72