cart code- handle
unknown
plain_text
2 years ago
884 B
10
Indexable
if (lineItem.variant.product.handle == null) {
const masterProduct = await dataSource
.getRepository(Product)
.createQueryBuilder('prod')
.select(['prod.handle as handle'])
.where('prod.id = :master_product_id', { master_product_id: lineItem.variant.product.master_product_id })
.getRawOne();
lineItem.variant.product.handle = masterProduct.handle;
let array = {
handle: masterProduct.handle,
};
lineItem.metadata = { ...lineItem.metadata, ...lineItem.variant.metadata, ...array };
} else {
let array = {
handle: lineItem.variant.product.handle,
};
lineItem.metadata = {
...lineItem.metadata,
...lineItem.variant.metadata,
...array,
};
}Editor is loading...
Leave a Comment