Search...
getCheckoutSettings( )
Developer Preview
Retrieves the sites' checkout settings.
Description
The getCheckoutSettings()
function returns a Promise that resolves to checkout settings.
Syntax
function getCheckoutSettings(): Promise<GetCheckoutSettingsResponse>
getCheckoutSettings Parameters
This function does not take any parameters.
Returns
The requested checkout settings.
Return Type:
Promise<
GetCheckoutSettingsResponse
>NAME
TYPE
DESCRIPTION
checkoutSettings
CheckoutSettings
Checkout settings.
Was this helpful?
Get checkout settings without elevated permissions
Copy Code
1import { checkoutSettings } from 'wix-ecom-backend';23export async function myGetCheckoutSettingsFunction() {4 try {5 const settings = await checkoutSettings.getCheckoutSettings();6 console.log('Success! CheckoutSettings:', settings);7 return settings;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12}1314/* Promise resolves to:15{16 "checkoutSettings": {17 "checkoutPolicies": {18 "termsAndConditions": {19 "visible": true,20 "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."21 },22 "privacyPolicy": {23 "visible": true,24 "content": "Your privacy is important to us. Please review our Privacy Policy to understand how we collect, use, and disclose information."25 },26 "returnPolicy": {27 "visible": true,28 "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."29 },30 "digitalItemPolicy": {31 "visible": false,32 "content": ""33 },34 "contactUs": {35 "visible": true,36 "content": "Email: accs@mail.com"37 },38 "customPolicy": {39 "visible": true,40 "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.",41 "title": "Orders and Payments"42 }43 },44 "checkoutFields": {45 "subscriptionCheckbox": {46 "visible": true,47 "checkedByDefault": false48 },49 "policyAgreementCheckbox": {50 "visible": true,51 "checkedByDefault": false52 },53 "giftCardRedeemEnabled": true,54 "mitEnabled": false55 }56 }57}58*/
Get checkout settings without elevated permissions (export from backend code)
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { checkoutSettings } from 'wix-ecom-backend';34export const myGetCheckoutSettingsFunction = webMethod(Permissions.Anyone, async () => {5 try {6 const settings = await checkoutSettings.getCheckoutSettings();7 console.log('Success! CheckoutSettings:', settings);8 return settings;9 } catch (error) {10 console.error(error);11 // Handle the error12 }13});1415/* Promise resolves to:16{17 "checkoutSettings": {18 "checkoutPolicies": {19 "termsAndConditions": {20 "visible": true,21 "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."22 },23 "privacyPolicy": {24 "visible": true,25 "content": "Your privacy is important to us. Please review our Privacy Policy to understand how we collect, use, and disclose information."26 },27 "returnPolicy": {28 "visible": true,29 "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."30 },31 "digitalItemPolicy": {32 "visible": false,33 "content": ""34 },35 "contactUs": {36 "visible": true,37 "content": "Email: accs@mail.com"38 },39 "customPolicy": {40 "visible": true,41 "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.",42 "title": "Orders and Payments"43 }44 },45 "checkoutFields": {46 "subscriptionCheckbox": {47 "visible": true,48 "checkedByDefault": false49 },50 "policyAgreementCheckbox": {51 "visible": true,52 "checkedByDefault": false53 },54 "giftCardRedeemEnabled": true,55 "mitEnabled": false56 }57 }58}59*/60
Get checkout settings with elevated permissions
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { checkoutSettings } from 'wix-ecom-backend';3import { elevate } from 'wix-auth';45export const myGetCheckoutSettingsFunction = webMethod(Permissions.Anyone, async () => {6 try {7 const elevatedGetCheckoutSettings = elevate(checkoutSettings.getCheckoutSettings);8 const getCheckoutSettings = await elevatedGetCheckoutSettings();9 console.log('Success! Checkout settings:', getCheckoutSettings);10 return getCheckoutSettings;11 } catch (error) {12 console.error(error);13 // Handle the error14 }15});16/* Promise resolves to:17{18 "checkoutSettings": {19 "checkoutPolicies": {20 "termsAndConditions": {21 "visible": true,22 "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."23 },24 "privacyPolicy": {25 "visible": true,26 "content": "Your privacy is important to us. Please review our Privacy Policy to understand how we collect, use, and disclose information."27 },28 "returnPolicy": {29 "visible": true,30 "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."31 },32 "digitalItemPolicy": {33 "visible": false,34 "content": ""35 },36 "contactUs": {37 "visible": true,38 "content": "Email: accs@mail.com"39 },40 "customPolicy": {41 "visible": true,42 "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.",43 "title": "Orders and Payments"44 }45 },46 "checkoutFields": {47 "subscriptionCheckbox": {48 "visible": true,49 "checkedByDefault": false50 },51 "policyAgreementCheckbox": {52 "visible": true,53 "checkedByDefault": false54 },55 "giftCardRedeemEnabled": true,56 "mitEnabled": false57 }58 }59}60*/61