Attribute API & Images Upload API #3
-
Hi there, But this doesn't work. My second issue is that I don't get the product attributes through the API that I create through the API. If i call it inside Swell I get everything as expected but if i call it in my storefront I only get an empty object. Is this a bug or have I missed something as I am creating the products through the API call. This is how I pass the product attributes: attributes: { |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@JanikHalder Please find the steps to upload images in Swell and associate to a product or any of the swell components.
const swell = require('swell-node').init('store-id', 'secret-key');
let fileData = {
filename: 'filename.png',
content_type: 'image/png',
data: {
$binary: '<imageDataInBase64>'
}
}
const fileResponse = await swell.post(`/:files`, fileData);
await swell.put('/products/<product_id>', {
images: [
{ file: fileResponse }
]
}); |
Beta Was this translation helpful? Give feedback.
-
@JanikHalder Regarding the attribute API, the attribute will be shown in storefront API (or swell-js) only if it matches the below conditions:
On a side note, you don't need to expand by |
Beta Was this translation helpful? Give feedback.
@JanikHalder Please find the steps to upload images in Swell and associate to a product or any of the swell components.