getProduct( )
Gets all the information associated with the current product.
Description
The getProduct()
function returns a Promise that is resolved when all
of the information about the product shown on the ProductPage
is
retrieved.
Syntax
function getProduct(): Promise<Product>
getProduct Parameters
This function does not take any parameters.
Returns
Fulfilled - Information about the current product.
Return Type:
NAME
TYPE
DESCRIPTION
Product ID.
Date and time the product was last updated.
Product name.
Product description.
Main product media item (image or video thumbnail) URL.
List of product media items.
Product stock keeping unit value. Must be unique.
Deprecated. Use ribbon
instead.
Product currency.
Product price. The price must be greater than its discount. The product price is propagated to the product's newly-created variants. Product variants whose prices have been updated directly are not affected by the changes to the product price.
Discounted product price.
Product price formatted with the currency.
Discounted product price formatted with the currency.
ID for the inventory item.
Product discount.
Indicates whether inventory is tracked for the product.
Indicates whether the product is in stock.
Number of units currently in stock.
Additional product information sections.
All the available options for a store product.
Product page relative URL.
Indicates whether product variants are managed. Can be set to true only if the product has options. Once set to true, manageVariants
can only be reset to false only if no variants exist. Use getProductVariants()
to check if variants exist. You cannot set manageVariants
to true if more than 300 variants are defined.
List of product customization fields.
Product type. Either "physical"
or "digital"
. When creating a product using the API, currently only "physical"
is supported.
Product slug.
Product weight.
Product variants.
Price per unit.
Price per unit formatted with currency symbol.
Details of the product's price per unit.
Product ribbon. Used to highlight relevant information about a product. For example, "Sale"
, "New Arrival"
, "Sold Out"
.
Was this helpful?
Get the current product's information
1$w('#myProductPage').getProduct()2 .then((product) => {3 let productName = product.name;4 let productDescription = product.description;5 // see example product object below6 })7 .catch((error) => {8 console.error(error);9 });1011/*12 * Example product object:13 *14 * {15 * "_id": "91f7ac8b-2baa-289c-aa50-6d64764f35d3",16 * "_updatedDate": "Wed Jan 20 2021 10:54:48 GMT+0200",17 * "name": "Colombian Arabica",18 * "description": "<p>The best organic coffee that Colombia has to offer.</p>",19 * "mainMedia": "wix:image://v1/nsplsh_5033504669385448625573~mv2_d_6000_3376_s_4_2.jpg/file.jpg#originWidth=6000&originHeight=3376",20 * "mediaItems": [21 * {22 * "id": "nsplsh_5033504669385448625573~mv2_d_6000_3376_s_4_2.jpg",23 * "src": "wix:image://v1/nsplsh_5033504669385448625573~mv2_d_6000_3376_s_4_2.jpg/file.jpg#originWidth=6000&originHeight=3376",24 * "description": "",25 * "title": "",26 * "link": "undefined",27 * "type": "Image"28 * }29 * ],30 * "sku": "undefined",31 * "ribbons": [{"text": "Organic and Fair trade"}],32 * "ribbon": "Organic and Fair trade",33 * "currency": "USD",34 * "price": 35,35 * "discountedPrice": 30,36 * "formattedPrice": "$35.00",37 * "formattedDiscountedPrice": "$30.00",38 * "pricePerUnit": 0.12,39 * "formattedPricePerUnit": "$0.12",40 * "pricePerUnitData": {41 * "totalQuantity": 250,42 * "totalMeasurementUnit": "G",43 * "baseQuantity": 1,44 * "baseMeasurementUnit": "G"45 * },46 * "inventoryItemId": "6e085374-d455-d763-55af-929b89b0ca2c",47 * "discount": {48 * "type": "AMOUNT",49 * "value": 550 * },51 * "trackInventory": false,52 * "inStock": true,53 * "quantityInStock": "undefined",54 * "additionalInfoSections": [55 * {56 * "title": "Storage recommendations",57 * "description": "<p>To preserve your beans' fresh roasted flavor as long as possible, store them in an opaque, air-tight container at room temperature.</p>\n"58 * }59 * ],60 * "productOptions": {61 * "Weight": {62 * "optionType": "drop_down",63 * "name": "Weight",64 * "choices": [65 * {66 * "value": "250g",67 * "description": "250g",68 * "inStock": true,69 * "visible": true,70 * "mainMedia": "wix:image://v1/614034_103e8f4ab0ae4536a38b319d3eb437ed~mv2.png/missing-media.png#originWidth=500&originHeight=500",71 * "mediaItems": []72 * },73 * {74 * "value": "500g",75 * "description": "500g",76 * "inStock": true,77 * "visible": true,78 * "mainMedia": "wix:image://v1/614034_103e8f4ab0ae4536a38b319d3eb437ed~mv2.png/missing-media.png#originWidth=500&originHeight=500",79 * "mediaItems": []80 * }81 * ]82 * },83 * "Ground for": {84 * "optionType": "drop_down",85 * "name": "Ground for",86 * "choices": [87 * {88 * "value": "Stovetop",89 * "description": "Stovetop",90 * "inStock": true,91 * "visible": true,92 * "mainMedia": "wix:image://v1/614034_103e8f4ab0ae4536a38b319d3eb437ed~mv2.png/missing-media.png#originWidth=500&originHeight=500",93 * "mediaItems": []94 * },95 * {96 * "value": "Filter",97 * "description": "Filter",98 * "inStock": true,99 * "visible": true,100 * "mainMedia": "null",101 * "mediaItems": []102 * }103 * ]104 * }105 * },106 * "productPageUrl": "/product-page/colombian-arabica-1",107 * "customTextFields": [108 * {109 * "title": "What would you like us to print on the custom label?",110 * "maxLength": 200,111 * "mandatory": false112 * }113 * ],114 * "manageVariants": true,115 * "productType": "physical",116 * "slug": "colombian-arabica-1",117 * "weight": "undefined",118 * "collections": "undefined",119 * "seoData": {120 * "tags": [121 * {122 * "type": "title",123 * "children": "Colombian Arabica | Organic and Fair Trade",124 * "custom": false,125 * "disabled": false126 * },127 * {128 * "type": "meta",129 * "props": {130 * "name": "description",131 * "content": "The best organic fair trade coffee that Colombia has to offer."132 * },133 * "children": "",134 * "custom": false,135 * "disabled": false136 * }137 * ]138 * },139 * "variants": [140 * {141 * "_id": "00000000-0000-0020-0005-a316e6ba5b37",142 * "choices": {143 * "Weight": "250g",144 * "Ground for": "Stovetop"145 * },146 * "variant": {147 * "currency": "USD",148 * "price": 35,149 * "discountedPrice": 30,150 * "pricePerUnit": 0.12,151 * "formattedPrice": "$35.00",152 * "formattedDiscountedPrice": "$35.00",153 * "formattedPricePerUnit": "$0.12",154 * "weight": 0.25,155 * "sku": "10001",156 * "visible": true157 * }158 * },159 * {160 * "_id": "00000000-0000-0021-0005-a316e6ba5b37",161 * "choices": {162 * "Weight": "250g",163 * "Ground for": "Filter"164 * },165 * "variant": {166 * "currency": "USD",167 * "price": 40,168 * "discountedPrice": 35,169 * "pricePerUnit": 0.14,170 * "formattedPrice": "$40.00",171 * "formattedDiscountedPrice": "$40.00",172 * "formattedPricePerUnit": "$0.14",173 * "weight": 0.25,174 * "sku": "10003",175 * "visible": true176 * }177 * },178 * {179 * "_id": "00000000-0000-003f-0005-a316e6ba5b37",180 * "choices": {181 * "Weight": "500g",182 * "Ground for": "Stovetop"183 * },184 * "variant": {185 * "currency": "USD",186 * "price": 65,187 * "discountedPrice": 60,188 * "pricePerUnit": 0.24,189 * "formattedPrice": "$65.00",190 * "formattedDiscountedPrice": "$65.00",191 * "formattedPricePerUnit": "$0.24",192 * "weight": 0.5,193 * "sku": "10002",194 * "visible": true195 * }196 * },197 * {198 * "_id": "00000000-0000-0040-0005-a316e6ba5b37",199 * "choices": {200 * "Weight": "500g",201 * "Ground for": "Filter"202 * },203 * "variant": {204 * "currency": "USD",205 * "price": 70,206 * "discountedPrice": 65,207 * "pricePerUnit": 0.26,208 * "formattedPrice": "$70.00",209 * "formattedDiscountedPrice": "$70.00",210 * "formattedPricePerUnit": "$0.26",211 * "weight": 1,212 * "sku": "10004",213 * "visible": true214 * }215 * }216 * ]217 * }218 *219 */