getCatalogItems( )
Retrieves item data from a custom catalog.
Description
This function is automatically called by Wix to retrieve the catalog items provided by your custom catalog extension. This happens when certain actions are performed on the cart and/or checkout. For example, when an item is added to the cart.
Where to find getCatalogItems()
When you add the Catalog custom extension,
a folder is automatically added to your site. Use the <my-extension-name>.js
file in the folder to write the code to determine which catalog items to retrieve.
For more information on customizing your catalog extension, see Tutorial: Catalog Custom Extension.
Syntax
function getCatalogItems(options: Options): Promise<Array<CatalogItems>>
getCatalogItems Parameters
NAME
TYPE
DESCRIPTION
Catalog and item references (IDs and additional info), weight unit, and quantities requested by Wix eCommerce.
Returns
Fulfilled - An array of catalog items and their data.
Return Type:
NAME
TYPE
DESCRIPTION
Catalog and item reference.
Item data.
Was this helpful?
Example of received `options` parameter and returned properties for `catalogItems` array
1export const getCatalogItems = async (options) => {23 // Example options parameter4 options = {5 "catalogReferences": [6 {7 "catalogReference": {8 "catalogItemId": "2",9 "appId": "7ff4b539-e3bf-4d8e-84d4-2ed180fce336",10 "options": {11 "options": {12 "week": "3"13 }14 }15 },16 "quantity": 117 }18 ],19 "weightUnit": "LB"20 }2122 // Example of returned catalogItems array23 return {24 "catalogItems": [25 {26 "catalogReference": {27 "appId": "7ff4b539-e3bf-4d8e-84d4-2ed180fce336",28 "catalogItemId": "2",29 "options": {30 "options": {31 "week": "3"32 }33 }34 },35 "data": {36 "productName": {37 "original": "EuroCamper",38 "translated": "EuroCamper"39 },40 "itemType": {41 "preset": "PHYSICAL"42 },43 "price": "540",44 "media": "wix:image://v1/11062b_7fba2fc327a04e1493f1a28213e8cae8~mv2.jpeg/camping-site#originWidth=6924&originHeight=3130",45 "descriptionLines": [46 {47 "name": {48 "original": "Beds",49 "translated": "Beds"50 },51 "lineType": "PLAIN_TEXT",52 "plainTextValue": {53 "original": "Type: Double, Quantity: 1\nType: King, Quantity: 1",54 "translated": "Type: Double, Quantity: 1\nType: King, Quantity: 1"55 },56 "plainText": {57 "original": "Type: Double, Quantity: 1\nType: King, Quantity: 1",58 "translated": "Type: Double, Quantity: 1\nType: King, Quantity: 1"59 }60 },61 {62 "name": {63 "original": "Size",64 "translated": "Size"65 },66 "lineType": "PLAIN_TEXT",67 "plainTextValue": {68 "original": "7x3x3",69 "translated": "7x3x3"70 },71 "plainText": {72 "original": "7x3x3",73 "translated": "7x3x3"74 }75 },76 {77 "name": {78 "original": "Description",79 "translated": "Description"80 },81 "lineType": "PLAIN_TEXT",82 "plainTextValue": {83 "original": "Professional Travelers RV for road trips, Enjoy a comfortable mobile home for the best family experience !",84 "translated": "Professional Travelers RV for road trips, Enjoy a comfortable mobile home for the best family experience !"85 },86 "plainText": {87 "original": "Professional Travelers RV for road trips, Enjoy a comfortable mobile home for the best family experience !",88 "translated": "Professional Travelers RV for road trips, Enjoy a comfortable mobile home for the best family experience !"89 }90 },91 {92 "name": {93 "original": "Additional Info",94 "translated": "Additional Info"95 },96 "lineType": "PLAIN_TEXT",97 "plainTextValue": {98 "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.",99 "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."100 },101 "plainText": {102 "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.",103 "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."104 }105 },106 {107 "name": {108 "original": "Week",109 "translated": "Week"110 },111 "lineType": "PLAIN_TEXT",112 "plainTextValue": {113 "original": "3",114 "translated": "3"115 },116 "plainText": {117 "original": "3",118 "translated": "3"119 }120 }121 ],122 "physicalProperties": {123 "shippable": true124 },125 "paymentOption": "FULL_PAYMENT_ONLINE",126 "quantityAvailable": 2127 }128 }129 ]130 }131};