fixed order variant

This commit is contained in:
Edward Yang 2022-11-21 14:14:26 +08:00
parent f893a77545
commit 8e67faf4fb
1 changed files with 6 additions and 1 deletions

View File

@ -29,11 +29,16 @@ class OrderProductRepo
{
$orderProducts = [];
foreach ($cartProducts as $cartProduct) {
$productName = $cartProduct['name'];
$variantLabels = $cartProduct['variant_labels'] ?? '';
if ($variantLabels) {
$productName .= " - {$variantLabels}";
}
$orderProducts[] = [
'product_id' => $cartProduct['product_id'],
'order_number' => $order->number,
'product_sku' => $cartProduct['product_sku'],
'name' => $cartProduct['name'],
'name' => $productName,
'image' => $cartProduct['image'],
'quantity' => $cartProduct['quantity'],
'price' => $cartProduct['price'],