Closed maxjnq closed 6 months ago
Hi, @maxjnq
Product information is included in the data.included
field.
An example of which is shown below:
const {
statusCode,
error,
data,
} = await listVariants({ include: ["product"] })
if(error)
console.log(statusCode, error)
else
console.log(data.included)
// [
// {
// type: "products",
// id: "164559",
// attributes: {
// store_id: 10612,
// name: "Test API",
// slug: "test-api",
// description: "<p>test</p>",
// status: "published",
// status_formatted: "Published",
// thumb_url: null,
// large_thumb_url: null,
// price: null,
// price_formatted: "Usage-based",
// from_price: null,
// to_price: null,
// pay_what_you_want: false,
// buy_now_url: "xxxxx",
// from_price_formatted: null,
// to_price_formatted: null,
// created_at: "2024-01-10T13:08:13.000000Z",
// updated_at: "2024-01-10T13:14:03.000000Z",
// test_mode: true,
// },
// // ...
// }
// ]
I hope this helps.
Oh great. Thanks a lot!
Hi guys,
When retrieving my variants including the product relationship for instance as follow
All I get in the relationships is product.types and product.id which has no use at all as each variants already include the product_id, variant.attributes.product_id.
What I think would be more useful is having more fields from the relationships, like product.name, and so on.
Am I miss using something?
Let me know.