Product
In order to get product information you need to interact with the channel endpoint. You can choose to get:
- All products from a specific channel
- Individual product information by using the product id
- Fetch all products in a specific currency.
- Fetch the Return information for a product or for all products.
- Fecht products with variants or without variants.
Products attributes:
This is the product attributes section of our eCommerce SDK documentation. As you build and integrate your eCommerce solutions, understanding the product attributes is crucial. These attributes provide essential details about the products in your store, ensuring seamless interaction and management. Below, you'll find a comprehensive list of attributes, their types, and descriptions to guide you through the integration process.
- Main
- Return
- Price
- Image
- Shipping
- Shipping Country
Property | Type | Description |
---|---|---|
id | Number | Unique identifier for the product. |
title | String | Name or title of the product. |
description | String | Detailed description of the product. |
tags | String | Tags associated with the product. |
sku | String | Stock Keeping Unit code for the product. |
quantity | Number | Available quantity of the product in stock. |
price | Object | Pricing details of the product. |
variants | Array | Different variations of the product (e.g., size, color). |
barcode | String | Barcode associated with the product. |
options | Array | Additional options related to the product. |
categories | Array | Categories the product belongs to. |
images | Array | Array of image URLs representing the product. |
product_shipping | Array | Shipping options and details for the product. |
supplier | String | Supplier or manufacturer of the product. |
imported_product | Object | Details if the product is imported or has special attributes. |
referral_fee | Number | Fee for referring the product to others. |
return | Object | Return policy and details for the product. |
Property | Type | Description |
---|---|---|
return_right | String | Number of days for the return right. 10 or 30 |
return_label | String | Indicates if the return label is included.-> included or not_included |
return_cost | String | Who bears the return cost -> vendor or customer . |
supplier_policy | String | Detailed supplier policy, including shipping and return details. |
Price
Property | Type | Description |
---|---|---|
amount | Number | The price of the product. |
currency_code | String | The currency code for the amount. |
compare_at | Number | The original price for comparison. |
Images
Property | Type | Description |
---|---|---|
id | Number | Unique identifier for the image. |
url | String | Direct link to the image. |
width | Number | Width of the image in pixels. |
height | Number | Height of the image in pixels. |
order | Number | The order or sequence in which the image should appear. |
Product Shipping Object
Property | Type | Description | Notes |
---|---|---|---|
id | String | Unique identifier for the shipping type. | |
name | String | Name of the shipping method. | |
description | String | Description of the shipping method. | |
custom_price_enabled | Boolean | Indicates if custom pricing is enabled. | |
default | Boolean | Indicates if this is the default method. | |
shipping_country | Array | List of countries and their shipping details. |
Shipping Country Object
Property | Type | Description | Notes |
---|---|---|---|
id | String | Unique identifier for the country shipping data. | |
amount | String | Shipping price for the country. | |
country | String | Country code. | |
currency_code | String | The currency code for the amount. | |
original_data | Object | Original data containing amount, currency, and base amount. | To be deprecated |
price | Object | Object containing the amount and currency code. |
Get all products
Retrieve an array of all the products to added to your channels.
Fetching all the products from the channel
const products = await sdk.channel.product.get({});
return products;
Parameters
Parameters | Type | Description |
---|---|---|
currency | String | Currency code for filtering the products. |
Fetching all the products with a specific currency
In this example, a function fetchAllProducts is defined to retrieve all products, but filtered by a specific currency. The getAll method on the sdk.products object is utilized, and it's invoked with a parameter 'NOK', which is a string representing the currency (Norwegian Krone in this case). This parameter instructs the getAll method to only retrieve products priced in the specified currency.
- Example
- Response
async function fetchAllProducts() => {
const currency = "NOK";
const products = await sdk.channel.product.get({ currency });
return products;
};
[
{
"id": 68785,
"title": "Citadel Grey Seer Spray 400ml",
"description": "<p>Makes undercoating and basing your models simple.</p>",
"tags": "",
"sku": "62-34",
"quantity": 96,
"price": {
"amount": 12,
"currency_code": "EUR",
"compare_at": 0
},
"variants": [],
"barcode": "5011921121885",
"options": [],
"categories": [
{
"id": 2248,
"name": "Paint"
}
],
"images": [
{
"id": "213691",
"url": "https://containerqa.reachu.io/reachu-uploads-qa/product-images/1710810194109.jpg?size=large",
"width": 800,
"height": 800,
"order": 0
},
{
"id": "213979",
"url": "https://containerqa.reachu.io/reachu-uploads-qa/products/blob-20240410105946933.jpeg?size=large",
"width": 1024,
"height": 768,
"order": 1
}
],
"product_shipping": [
{
"id": "8427b5c7-4594-4678-a602-c9a1a9e27a63",
"name": "Default shipping",
"description": "flat rate",
"custom_price_enabled": false,
"default": false,
"shipping_country": [
{
"id": "180936b2-af9c-4406-bc95-bae90ba7f827",
"amount": "5.00",
"country": "NL",
"currency_code": "EUR"
},
{
"id": "2bb9d47a-277d-45c7-9798-4d3066982c0e",
"amount": "5.00",
"country": "DK",
"currency_code": "EUR"
},
{
"id": "4300ce7e-c5d2-43b1-93cb-0bba5f7ffed5",
"amount": "5.00",
"country": "NO",
"currency_code": "EUR"
},
{
"id": "67eb7b15-8520-4b92-b949-4ffcf5de7a79",
"amount": "5.00",
"country": "GB",
"currency_code": "EUR"
},
{
"id": "da107d58-591a-451b-b89e-23dbc5d784ad",
"amount": "5.00",
"country": "SE",
"currency_code": "EUR"
},
{
"id": "ec6fe3c9-cf4a-4e38-9bba-9bc79537af31",
"amount": "5.00",
"country": "AT",
"currency_code": "EUR"
}
]
}
],
"supplier": "georg+paint@reachu.io",
"imported_product": null,
"referral_fee": null,
"options_enabled": false,
"digital": false,
"origin": "NATIVE",
"return": {
"return_right": null,
"return_label": null,
"return_cost": null,
"supplier_policy": null,
"return_address": {
"same_as_business": null,
"same_as_warehouse": null,
"country": null,
"timezone": null,
"address": null,
"address_2": null,
"post_code": null,
"return_city": null
}
}
},
{
"id": 387853,
"title": "Vallejo Black Model Color Paint, 17ml",
"description": "<ul><li>Model color has been formulated with permanent pigments for fine arts; all colors are completely lightfast and opaque</li><li>The consistency of Model color allows for an extremely smooth and uniform paint film, with no trace of brushstrokes</li><li>The water based formula of Model color has been specifically developed for adherence on difficult surfaces such as metal and plastic</li></ul>",
"tags": "",
"sku": "8429551709507",
"quantity": 100,
"price": {
"amount": 10,
"currency_code": "EUR",
"compare_at": 0
},
"variants": [],
"barcode": "70.950",
"options": [],
"categories": [
{
"id": 2248,
"name": "Paint"
}
],
"images": [
{
"id": "213989",
"url": "https://containerqa.reachu.io/reachu-uploads-qa/product-images/387853-8086dbbf-e944-46e2-9461-a58e495c801b.jpeg?size=large",
"width": 276,
"height": 879,
"order": 0
},
{
"id": "213992",
"url": "https://containerqa.reachu.io/reachu-uploads-qa/product-images/387853-93ffd503-5051-4e0c-ab3d-34b3823a7b32.png?size=large",
"width": 168,
"height": 300,
"order": 1
},
{
"id": "213993",
"url": "https://containerqa.reachu.io/reachu-uploads-qa/product-images/387853-b6b6b204-936e-4a11-ba4f-934ab946b3dc.png?size=large",
"width": 539,
"height": 710,
"order": 2
}
],
"product_shipping": [
{
"id": "4584b8ff-66f1-4bc0-9e41-5e71ef76186c",
"name": "Standard UK next day Shipping",
"description": "Standard UK next day Shipping",
"custom_price_enabled": false,
"default": false,
"shipping_country": [
{
"id": "127fe89b-a828-41c7-bf3b-f27fe42ba7d6",
"amount": "4.00",
"country": "YT",
"currency_code": "EUR"
},
{
"id": "19186d40-fa18-411d-8613-5aad9184f76d",
"amount": "4.00",
"country": "IS",
"currency_code": "EUR"
},
{
"id": "1c1c881a-b6c9-4889-b973-9845460f0b74",
"amount": "4.00",
"country": "GI",
"currency_code": "EUR"
},
{
"id": "283ed795-ebd1-4da5-80f6-267a3032c9e5",
"amount": "4.00",
"country": "HU",
"currency_code": "EUR"
},
{
"id": "312eec47-22dc-40a1-8250-1f57887ddabb",
"amount": "4.00",
"country": "NL",
"currency_code": "EUR"
},
{
"id": "38a831ef-f5eb-443f-873b-bfecde379ef6",
"amount": "4.00",
"country": "BZ",
"currency_code": "EUR"
},
{
"id": "4cc1a587-8f5a-4063-b380-8cb7d2a6cb07",
"amount": "4.00",
"country": "LU",
"currency_code": "EUR"
},
{
"id": "50ad5561-8b51-414a-89a7-3f27ec12a7e8",
"amount": "4.00",
"country": "BA",
"currency_code": "EUR"
},
{
"id": "5877c33a-60f5-46c4-b8f0-4a76f10eb4cb",
"amount": "4.00",
"country": "MC",
"currency_code": "EUR"
},
{
"id": "5b65b0dd-f2d3-4f7a-811c-49bd5e92cade",
"amount": "4.00",
"country": "SK",
"currency_code": "EUR"
},
{
"id": "635e99c6-6760-4550-9843-971367eae40e",
"amount": "4.00",
"country": "NO",
"currency_code": "EUR"
},
{
"id": "6e40d55f-d46d-4742-bebd-0cace0346830",
"amount": "4.00",
"country": "SE",
"currency_code": "EUR"
},
{
"id": "770bf116-1301-408d-a8e0-7d2ec2349c73",
"amount": "4.00",
"country": "AZ",
"currency_code": "EUR"
},
{
"id": "7a537dd7-2f3a-4b2a-aec9-0d7ca9d0e89a",
"amount": "4.00",
"country": "GE",
"currency_code": "EUR"
},
{
"id": "8380c4b7-507a-4a12-b42d-8cfabd0f818b",
"amount": "4.00",
"country": "SJ",
"currency_code": "EUR"
},
{
"id": "883f0559-e041-4ebc-8636-086f20c19d1c",
"amount": "4.00",
"country": "BG",
"currency_code": "EUR"
},
{
"id": "8c1593ed-ed62-42b0-9c82-c4db399443b2",
"amount": "4.00",
"country": "LT",
"currency_code": "EUR"
},
{
"id": "8fc6a201-d98a-4af1-a353-41ea0e5d6883",
"amount": "4.00",
"country": "ES",
"currency_code": "EUR"
},
{
"id": "973d074f-6b52-4a04-ba27-07fcf8739552",
"amount": "4.00",
"country": "AT",
"currency_code": "EUR"
},
{
"id": "9a7115ea-05f7-4158-b521-e9dfb9aaa36d",
"amount": "4.00",
"country": "US",
"currency_code": "EUR"
},
{
"id": "aff87b0c-3e00-45ba-baae-7633bd825b8b",
"amount": "4.00",
"country": "MT",
"currency_code": "EUR"
},
{
"id": "bc3483e5-1a7c-4cca-bde4-e949ecc818ad",
"amount": "4.00",
"country": "AM",
"currency_code": "EUR"
},
{
"id": "bcdd2f45-a02d-49a3-a2fa-1c47c4a5535c",
"amount": "4.00",
"country": "GB",
"currency_code": "EUR"
},
{
"id": "c98d3c76-18a8-4ab1-b952-08484e0ca5e8",
"amount": "4.00",
"country": "IT",
"currency_code": "EUR"
},
{
"id": "d2d1c12e-d72c-45c1-a414-d1bd9a0469a5",
"amount": "4.00",
"country": "ME",
"currency_code": "EUR"
},
{
"id": "d893e722-00d0-49f1-b808-8feb039a3da0",
"amount": "4.00",
"country": "CZ",
"currency_code": "EUR"
},
{
"id": "e0e4b823-12e3-436e-947e-252932b53f63",
"amount": "4.00",
"country": "DE",
"currency_code": "EUR"
},
{
"id": "fc156a57-2aed-4758-b993-dc7a130f674c",
"amount": "4.00",
"country": "RS",
"currency_code": "EUR"
}
]
}
],
"supplier": "Paint Supply XYZ",
"imported_product": null,
"referral_fee": 10,
"options_enabled": false,
"digital": false,
"origin": "NATIVE",
"return": {
"return_right": null,
"return_label": null,
"return_cost": null,
"supplier_policy": null,
"return_address": {
"same_as_business": null,
"same_as_warehouse": null,
"country": null,
"timezone": null,
"address": null,
"address_2": null,
"post_code": null,
"return_city": null
}
}
},
]
Fetching all the products without variants
async function fetchAllProducts(() => {
const products = await sdk.products.getAll('NOK', {returnVariants: false});
return products;
});
Fetching all the products with return policy
async function fetchAllProducts(() => {
const products = await sdk.products.getAll('NOK', {returnVariants: false, return: true});
return products;
});
Get products by ids
This function allows you to retrieve an array of products that have been added to your channel based on their IDs.
Function Signature
async function fetchAllProducts((productIds) => {
const fetchProductsByIds = await sdk.channel.product.getByIds({ product_ids: productIds });
return products;
});
As when fetching all the products, you may also add a custom currency:
async function fetchAllProducts((productIds, currency) => {
const fetchProductsByIds = await sdk.channel.product.getByIds({
product_ids: productIds,
currency
});
return products;
});
Parameters
Parameters | Type | Description |
---|---|---|
product_ids | Array | An array of product IDs you wish to retrieve. |
currency | String | Currency code for filtering the products. |
Example 1: Fetching a Singel product
If you want to fetch a single product, simply pass an array with one product ID:
- Example
- Response
Example:
const productIds = [12345]; // Replace 12345 with your product ID
const products = fetchProductsByIds(productIds);
console.log(products);
Response:
[
{
"id": 68766,
"title": "Citadel Base: Castellan Green 12ml",
"description": "<p>Citadel Base paints are high quality acrylic paints specially formulated for basecoating your Citadel miniatures quickly and easily. They are designed to give a smooth matte finish over black or white undercoats with a single layer.</p><p><br></p><p>All of our paints are non-toxic, water-based acrylic that are designed for use on plastic, metal, and resin Citadel miniatures. One pot contains 12ml of base paint.</p>",
"tags": "",
"sku": "GWS21-14",
"quantity": null,
"price": {
"amount": 45.28,
"currency_code": "NOK",
"compare_at": 46.8
},
"variants": [],
"barcode": "5011921026418",
"options": [],
"categories": [
{
"id": 2248,
"name": "Paint"
}
],
"images": [
{
"id": "213667",
"url": "https://containerqa.reachu.io/reachu-uploads-qa/product-images/1710550974093.jpg?size=large",
"width": 1238,
"height": 1280,
"order": 0
}
],
"product_shipping": [
{
"id": "8427b5c7-4594-4678-a602-c9a1a9e27a63",
"name": "Default shipping",
"description": "flat rate",
"custom_price_enabled": false,
"default": false,
"shipping_country": [
{
"id": "180936b2-af9c-4406-bc95-bae90ba7f827",
"amount": "58.5",
"country": "NL",
"currency_code": "NOK"
},
{
"id": "2bb9d47a-277d-45c7-9798-4d3066982c0e",
"amount": "58.5",
"country": "DK",
"currency_code": "NOK"
},
{
"id": "4300ce7e-c5d2-43b1-93cb-0bba5f7ffed5",
"amount": "58.5",
"country": "NO",
"currency_code": "NOK"
},
{
"id": "67eb7b15-8520-4b92-b949-4ffcf5de7a79",
"amount": "58.5",
"country": "GB",
"currency_code": "NOK"
},
{
"id": "da107d58-591a-451b-b89e-23dbc5d784ad",
"amount": "58.5",
"country": "SE",
"currency_code": "NOK"
},
{
"id": "ec6fe3c9-cf4a-4e38-9bba-9bc79537af31",
"amount": "58.5",
"country": "AT",
"currency_code": "NOK"
}
]
}
],
"supplier": "georg+paint@reachu.io",
"imported_product": null,
"referral_fee": null,
"options_enabled": false,
"digital": false,
"origin": "NATIVE",
"return": {
"return_right": null,
"return_label": null,
"return_cost": null,
"supplier_policy": null,
"return_address": {
"same_as_business": null,
"same_as_warehouse": null,
"country": null,
"timezone": null,
"address": null,
"address_2": null,
"post_code": null,
"return_city": null
}
}
}
]
Example 2: Fetching Multiple Products
To fetch multiple products, extend the array to include all the product IDs you're interested in:
- Example
- Response
const productIds = [12345, 67890]; // Replace with your product IDs
const products = fetchProductsByIds(productIds, "NOK");
console.log(products);
[
{
"id": 68767,
"title": "Citadel Base: Catachan Flesh 12ml",
"description": "<p>Citadel Base paints are high quality acrylic paints specially formulated for basecoating your Citadel miniatures quickly and easily. They are designed to give a smooth matte finish over black or white undercoats with a single layer.</p><p><br></p><p>All of our paints are non-toxic, water-based acrylic that are designed for use on plastic, metal, and resin Citadel miniatures. One pot contains 12ml of base paint.</p>",
"tags": "",
"sku": "EE4HRCWQWMYV9ZAN",
"quantity": 100,
"price": {
"amount": 81.9,
"currency_code": "NOK",
"compare_at": null
},
"variants": [],
"barcode": "5011921121113",
"options": [],
"categories": [
{
"id": 2248,
"name": "Paint"
}
],
"images": [
{
"id": "213668",
"url": "https://containerqa.reachu.io/reachu-uploads-qa/product-images/1710550974241.jpg?size=large",
"width": 2432,
"height": 2432,
"order": 0
}
],
"product_shipping": [
{
"id": "8427b5c7-4594-4678-a602-c9a1a9e27a63",
"name": "Default shipping",
"description": "flat rate",
"custom_price_enabled": false,
"default": false,
"shipping_country": [
{
"id": "180936b2-af9c-4406-bc95-bae90ba7f827",
"amount": "58.5",
"country": "NL",
"currency_code": "NOK"
},
{
"id": "2bb9d47a-277d-45c7-9798-4d3066982c0e",
"amount": "58.5",
"country": "DK",
"currency_code": "NOK"
},
{
"id": "4300ce7e-c5d2-43b1-93cb-0bba5f7ffed5",
"amount": "58.5",
"country": "NO",
"currency_code": "NOK"
},
{
"id": "67eb7b15-8520-4b92-b949-4ffcf5de7a79",
"amount": "58.5",
"country": "GB",
"currency_code": "NOK"
},
{
"id": "da107d58-591a-451b-b89e-23dbc5d784ad",
"amount": "58.5",
"country": "SE",
"currency_code": "NOK"
},
{
"id": "ec6fe3c9-cf4a-4e38-9bba-9bc79537af31",
"amount": "58.5",
"country": "AT",
"currency_code": "NOK"
}
]
}
],
"supplier": "georg+paint@reachu.io",
"imported_product": null,
"referral_fee": null,
"options_enabled": false,
"digital": false,
"origin": "NATIVE",
"return": {
"return_right": null,
"return_label": null,
"return_cost": null,
"supplier_policy": null,
"return_address": {
"same_as_business": null,
"same_as_warehouse": null,
"country": null,
"timezone": null,
"address": null,
"address_2": null,
"post_code": null,
"return_city": null
}
}
},
{
"id": 68766,
"title": "Citadel Base: Castellan Green 12ml",
"description": "<p>Citadel Base paints are high quality acrylic paints specially formulated for basecoating your Citadel miniatures quickly and easily. They are designed to give a smooth matte finish over black or white undercoats with a single layer.</p><p><br></p><p>All of our paints are non-toxic, water-based acrylic that are designed for use on plastic, metal, and resin Citadel miniatures. One pot contains 12ml of base paint.</p>",
"tags": "",
"sku": "GWS21-14",
"quantity": null,
"price": {
"amount": 45.28,
"currency_code": "NOK",
"compare_at": 46.8
},
"variants": [],
"barcode": "5011921026418",
"options": [],
"categories": [
{
"id": 2248,
"name": "Paint"
}
],
"images": [
{
"id": "213667",
"url": "https://containerqa.reachu.io/reachu-uploads-qa/product-images/1710550974093.jpg?size=large",
"width": 1238,
"height": 1280,
"order": 0
}
],
"product_shipping": [
{
"id": "8427b5c7-4594-4678-a602-c9a1a9e27a63",
"name": "Default shipping",
"description": "flat rate",
"custom_price_enabled": false,
"default": false,
"shipping_country": [
{
"id": "180936b2-af9c-4406-bc95-bae90ba7f827",
"amount": "58.5",
"country": "NL",
"currency_code": "NOK"
},
{
"id": "2bb9d47a-277d-45c7-9798-4d3066982c0e",
"amount": "58.5",
"country": "DK",
"currency_code": "NOK"
},
{
"id": "4300ce7e-c5d2-43b1-93cb-0bba5f7ffed5",
"amount": "58.5",
"country": "NO",
"currency_code": "NOK"
},
{
"id": "67eb7b15-8520-4b92-b949-4ffcf5de7a79",
"amount": "58.5",
"country": "GB",
"currency_code": "NOK"
},
{
"id": "da107d58-591a-451b-b89e-23dbc5d784ad",
"amount": "58.5",
"country": "SE",
"currency_code": "NOK"
},
{
"id": "ec6fe3c9-cf4a-4e38-9bba-9bc79537af31",
"amount": "58.5",
"country": "AT",
"currency_code": "NOK"
}
]
}
],
"supplier": "georg+paint@reachu.io",
"imported_product": null,
"referral_fee": null,
"options_enabled": false,
"digital": false,
"origin": "NATIVE",
"return": {
"return_right": null,
"return_label": null,
"return_cost": null,
"supplier_policy": null,
"return_address": {
"same_as_business": null,
"same_as_warehouse": null,
"country": null,
"timezone": null,
"address": null,
"address_2": null,
"post_code": null,
"return_city": null
}
}
}
]
Additional Query Methods
Retrieve Products by Categories
Single Category
Retrieve all products associated with a specific category by providing the category ID as a string.
// Fetch products by a single category ID
fetchedProducts = await sdkClient.channel.product.getByCategoryId({
category_id: String((product.categories as Array)[0].id),
currency,
});
console.info('Products retrieved by category ID:', fetchedProducts);
Multiple Categories
Fetch products that belong to multiple categories by submitting the category IDs as an array.
// Fetch products by multiple category IDs
fetchedProducts = await sdkClient.channel.product.getByCategoryIds({
category_ids: [String((product.categories as Array)[0].id)],
currency,
});
console.info('Products retrieved by multiple category IDs:', fetchedProducts);
Retrieve Products Using Specific Parameters
You can fetch products based on specific attributes such as barcode, SKU, or product ID.
Simply invoke the getByParams method and provide the relevant parameters as shown in the examples below:
// Fetch product by barcode
fetchedProduct = await sdkClient.channel.product.getByParams({
barcode: String(product.barcode),
currency,
});
console.info('Products retrieved by barcode:', fetchedProduct);
// Fetch product by SKU
fetchedProduct = await sdkClient.channel.product.getByParams({
sku: String(product.sku),
currency,
});
console.info('Products retrieved by SKU:', fetchedProduct);
// Fetch product by product ID
fetchedProduct = await sdkClient.channel.product.getByParams({
product_id: product.id,
currency,
});
console.info('Products retrieved by product ID:', fetchedProduct);
Retrieve Products by Multiple SKUs
Retrieve a list of products by specifying multiple Stock Keeping Units (SKUs). This method allows you to query products using a comma-separated string of SKUs, and you can also specify the currency and desired image size for the returned product data.
// Fetch products by multiple SKUs
products = await sdkClient.channel.product.getBySkus({
skuStringList: `${products[0].sku},${products[1].sku}`,
image_size: 'large',
});
console.info('Products retrieved by SKUs:', products);