Retrieves item data from a custom catalog.
This function is automatically called by Wix to retrieve the catalog items provided by your custom catalog plugin. This happens when certain actions are performed on the cart and/or checkout. For example, when an item is added to the cart.
getCatalogItems()
When you add the Catalog service plugin,
a folder is automatically added to your site. Use the .js
file in the folder to write the code to determine which catalog items to retrieve.
For more information on customizing your catalog plugin, see Velo Tutorial: eCommerce Catalog Service Plugin.
function getCatalogItems(
options: Options,
context: Context,
): Promise<Array<CatalogItems>>;
Catalog and item references (IDs and additional info), weight unit, and quantities requested by Wix eCommerce.
Metadata about the request.
export const getCatalogItems = async (options) => {
// Example options parameter
options = {
catalogReferences: [
{
catalogReference: {
catalogItemId: "2",
appId: "7ff4b539-e3bf-4d8e-84d4-2ed180fce336",
options: {
options: {
week: "3",
},
},
},
quantity: 1,
},
],
weightUnit: "LB",
};
// Example of returned catalogItems array
return {
catalogItems: [
{
catalogReference: {
appId: "7ff4b539-e3bf-4d8e-84d4-2ed180fce336",
catalogItemId: "2",
options: {
options: {
week: "3",
},
},
},
data: {
productName: {
original: "EuroCamper",
translated: "EuroCamper",
},
itemType: {
preset: "PHYSICAL",
},
price: "540",
media:
"wix:image://v1/11062b_7fba2fc327a04e1493f1a28213e8cae8~mv2.jpeg/camping-site#originWidth=6924&originHeight=3130",
descriptionLines: [
{
name: {
original: "Beds",
translated: "Beds",
},
lineType: "PLAIN_TEXT",
plainTextValue: {
original: "Type: Double, Quantity: 1\nType: King, Quantity: 1",
translated:
"Type: Double, Quantity: 1\nType: King, Quantity: 1",
},
plainText: {
original: "Type: Double, Quantity: 1\nType: King, Quantity: 1",
translated:
"Type: Double, Quantity: 1\nType: King, Quantity: 1",
},
},
{
name: {
original: "Size",
translated: "Size",
},
lineType: "PLAIN_TEXT",
plainTextValue: {
original: "7x3x3",
translated: "7x3x3",
},
plainText: {
original: "7x3x3",
translated: "7x3x3",
},
},
{
name: {
original: "Description",
translated: "Description",
},
lineType: "PLAIN_TEXT",
plainTextValue: {
original:
"Professional Travelers RV for road trips, Enjoy a comfortable mobile home for the best family experience !",
translated:
"Professional Travelers RV for road trips, Enjoy a comfortable mobile home for the best family experience !",
},
plainText: {
original:
"Professional Travelers RV for road trips, Enjoy a comfortable mobile home for the best family experience !",
translated:
"Professional Travelers RV for road trips, Enjoy a comfortable mobile home for the best family experience !",
},
},
{
name: {
original: "Additional Info",
translated: "Additional Info",
},
lineType: "PLAIN_TEXT",
plainTextValue: {
original:
"Deposit fee is 40$ per item\nReturning the item: return shipping is included with your order. All\nyou have to do is re-pack the hardware and it will be picked up by\nthe shipping company at the rental end date. If you cannot be\nreached, late fees will apply.\nCancelation: Orders will receive a full refund when canceled 10\nbusiness days before the rental start date.",
translated:
"Deposit fee is 40$ per item\nReturning the item: return shipping is included with your order. All\nyou have to do is re-pack the hardware and it will be picked up by\nthe shipping company at the rental end date. If you cannot be\nreached, late fees will apply.\nCancelation: Orders will receive a full refund when canceled 10\nbusiness days before the rental start date.",
},
plainText: {
original:
"Deposit fee is 40$ per item\nReturning the item: return shipping is included with your order. All\nyou have to do is re-pack the hardware and it will be picked up by\nthe shipping company at the rental end date. If you cannot be\nreached, late fees will apply.\nCancelation: Orders will receive a full refund when canceled 10\nbusiness days before the rental start date.",
translated:
"Deposit fee is 40$ per item\nReturning the item: return shipping is included with your order. All\nyou have to do is re-pack the hardware and it will be picked up by\nthe shipping company at the rental end date. If you cannot be\nreached, late fees will apply.\nCancelation: Orders will receive a full refund when canceled 10\nbusiness days before the rental start date.",
},
},
{
name: {
original: "Week",
translated: "Week",
},
lineType: "PLAIN_TEXT",
plainTextValue: {
original: "3",
translated: "3",
},
plainText: {
original: "3",
translated: "3",
},
},
],
physicalProperties: {
shippable: true,
},
paymentOption: "FULL_PAYMENT_ONLINE",
quantityAvailable: 2,
},
},
],
};
};
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.