Search.../

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:

Promise<Product>
NAME
TYPE
DESCRIPTION
_id

string

Product ID.

_updatedDate

Date

Date and time the product was last updated.

name

string

Product name.

description

string

Product description.

mainMedia

string

Main product media item (image or video thumbnail) URL.

mediaItems

MediaItem

List of product media items.

sku

string

Product stock keeping unit value. Must be unique.

ribbons

Array<ProductRibbon>

List of product ribbons.

currency

string

Product currency.

price

number

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.

discountedPrice

number

Discounted product price.

formattedPrice

string

Product price formatted with the currency.

formattedDiscountedPrice

string

Discounted product price formatted with the currency.

inventoryItemId

string

ID for the inventory item.

discount

ProductDiscount

Product discount.

trackInventory

boolean

Indicates whether inventory is tracked for the product.

inStock

boolean

Indicates whether the product is in stock.

quantityInStock

number

Number of units currently in stock.

additionalInfoSections

Array<ProductAdditionalInfoSection>

Additional product information sections.

productOptions

ProductOptions

All the available options for a store product.

productPageUrl

string

Product page relative URL.

manageVariants

boolean

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.

customTextFields

Array<ProductCustomTextFields>

List of product customization fields.

productType

string

Product type. Either "physical" or "digital". When creating a product using the API, currently only "physical" is supported.

slug

string

Product slug.

weight

number

Product weight.

variants

Array<VariantItem>

Product variants.

pricePerUnit

number

Price per unit.

formattedPricePerUnit

string

Price per unit formatted with currency symbol.

pricePerUnitData

pricePerUnitData

Details of the product's price per unit.

seoData

SeoData

Custom SEO data for the product. Learn more about SEO.

Was this helpful?

Get the current product's information

Code Example

Copy Code
1$w('#myProductPage').getProduct()
2 .then((product) => {
3 let productName = product.name;
4 let productDescription = product.description;
5 // see example product object below
6 })
7 .catch((error) => {
8 console.error(error);
9 });
10
11/*
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": [
32 * {
33 * "text": "Organic and Fair trade"
34 * }
35 * ],
36 * "currency": "USD",
37 * "price": 35,
38 * "discountedPrice": 30,
39 * "formattedPrice": "$35.00",
40 * "formattedDiscountedPrice": "$30.00",
41 * "pricePerUnit": 0.12,
42 * "formattedPricePerUnit": "$0.12",
43 * "pricePerUnitData": {
44 * "totalQuantity": 250,
45 * "totalMeasurementUnit": "G",
46 * "baseQuantity": 1,
47 * "baseMeasurementUnit": "G"
48 * },
49 * "inventoryItemId": "6e085374-d455-d763-55af-929b89b0ca2c",
50 * "discount": {
51 * "type": "AMOUNT",
52 * "value": 5
53 * },
54 * "trackInventory": false,
55 * "inStock": true,
56 * "quantityInStock": "undefined",
57 * "additionalInfoSections": [
58 * {
59 * "title": "Storage recommendations",
60 * "description": "<p>To&nbsp;preserve&nbsp;your beans' fresh roasted flavor as long as possible, store them in an opaque, air-tight container at room temperature.</p>\n"
61 * }
62 * ],
63 * "productOptions": {
64 * "Weight": {
65 * "optionType": "drop_down",
66 * "name": "Weight",
67 * "choices": [
68 * {
69 * "value": "250g",
70 * "description": "250g",
71 * "inStock": true,
72 * "visible": true,
73 * "mainMedia": "wix:image://v1/614034_103e8f4ab0ae4536a38b319d3eb437ed~mv2.png/missing-media.png#originWidth=500&originHeight=500",
74 * "mediaItems": []
75 * },
76 * {
77 * "value": "500g",
78 * "description": "500g",
79 * "inStock": true,
80 * "visible": true,
81 * "mainMedia": "wix:image://v1/614034_103e8f4ab0ae4536a38b319d3eb437ed~mv2.png/missing-media.png#originWidth=500&originHeight=500",
82 * "mediaItems": []
83 * }
84 * ]
85 * },
86 * "Ground for": {
87 * "optionType": "drop_down",
88 * "name": "Ground for",
89 * "choices": [
90 * {
91 * "value": "Stovetop",
92 * "description": "Stovetop",
93 * "inStock": true,
94 * "visible": true,
95 * "mainMedia": "wix:image://v1/614034_103e8f4ab0ae4536a38b319d3eb437ed~mv2.png/missing-media.png#originWidth=500&originHeight=500",
96 * "mediaItems": []
97 * },
98 * {
99 * "value": "Filter",
100 * "description": "Filter",
101 * "inStock": true,
102 * "visible": true,
103 * "mainMedia": "null",
104 * "mediaItems": []
105 * }
106 * ]
107 * }
108 * },
109 * "productPageUrl": "/product-page/colombian-arabica-1",
110 * "customTextFields": [
111 * {
112 * "title": "What would you like us to print on the custom label?",
113 * "maxLength": 200,
114 * "mandatory": false
115 * }
116 * ],
117 * "manageVariants": true,
118 * "productType": "physical",
119 * "slug": "colombian-arabica-1",
120 * "weight": "undefined",
121 * "collections": "undefined",
122 * "seoData": {
123 * "tags": [
124 * {
125 * "type": "title",
126 * "children": "Colombian Arabica | Organic and Fair Trade",
127 * "custom": false,
128 * "disabled": false
129 * },
130 * {
131 * "type": "meta",
132 * "props": {
133 * "name": "description",
134 * "content": "The best organic fair trade coffee that Colombia has to offer."
135 * },
136 * "children": "",
137 * "custom": false,
138 * "disabled": false
139 * }
140 * ]
141 * },
142 * "variants": [
143 * {
144 * "_id": "00000000-0000-0020-0005-a316e6ba5b37",
145 * "choices": {
146 * "Weight": "250g",
147 * "Ground for": "Stovetop"
148 * },
149 * "variant": {
150 * "currency": "USD",
151 * "price": 35,
152 * "discountedPrice": 30,
153 * "pricePerUnit": 0.12,
154 * "formattedPrice": "$35.00",
155 * "formattedDiscountedPrice": "$35.00",
156 * "formattedPricePerUnit": "$0.12",
157 * "weight": 0.25,
158 * "sku": "10001",
159 * "visible": true
160 * }
161 * },
162 * {
163 * "_id": "00000000-0000-0021-0005-a316e6ba5b37",
164 * "choices": {
165 * "Weight": "250g",
166 * "Ground for": "Filter"
167 * },
168 * "variant": {
169 * "currency": "USD",
170 * "price": 40,
171 * "discountedPrice": 35,
172 * "pricePerUnit": 0.14,
173 * "formattedPrice": "$40.00",
174 * "formattedDiscountedPrice": "$40.00",
175 * "formattedPricePerUnit": "$0.14",
176 * "weight": 0.25,
177 * "sku": "10003",
178 * "visible": true
179 * }
180 * },
181 * {
182 * "_id": "00000000-0000-003f-0005-a316e6ba5b37",
183 * "choices": {
184 * "Weight": "500g",
185 * "Ground for": "Stovetop"
186 * },
187 * "variant": {
188 * "currency": "USD",
189 * "price": 65,
190 * "discountedPrice": 60,
191 * "pricePerUnit": 0.24,
192 * "formattedPrice": "$65.00",
193 * "formattedDiscountedPrice": "$65.00",
194 * "formattedPricePerUnit": "$0.24",
195 * "weight": 0.5,
196 * "sku": "10002",
197 * "visible": true
198 * }
199 * },
200 * {
201 * "_id": "00000000-0000-0040-0005-a316e6ba5b37",
202 * "choices": {
203 * "Weight": "500g",
204 * "Ground for": "Filter"
205 * },
206 * "variant": {
207 * "currency": "USD",
208 * "price": 70,
209 * "discountedPrice": 65,
210 * "pricePerUnit": 0.26,
211 * "formattedPrice": "$70.00",
212 * "formattedDiscountedPrice": "$70.00",
213 * "formattedPricePerUnit": "$0.26",
214 * "weight": 1,
215 * "sku": "10004",
216 * "visible": true
217 * }
218 * }
219 * ]
220 * }
221 *
222 */