I have this repeatable Variants component inside Product and I want to update a single variant or item using its id
I am trying like this
const updatedVariants = item.product.Variants.map((variantInMap) => {
if (variantInMap.id === variant.id) {
return {
...variantInMap,
Quantity: variantInMap.Quantity - item.Quantity,
};
}
return variantInMap;
});
const res = await strapi.entityService.update(
"api::product.product",
item.product.id,
{
data: {
Variants: updatedVariants,
},
}
);
console.log(res);
But with this I cant provide the updated Variants to next iteration
This topic has been created from a Discord post (1217875092005060759) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord