fix(core-flows): use product title for line item title (#12397)
* fix(core-flows): use prduct title for line item title * fix: module tests * fix: http tests * fix: display item subtitle instead of prod title as secondary text in line item * fix: claim/exchange items
This commit is contained in:
1 parent
9d29078b0d
commit
47700899ed
8 files changed
+29
-27
No files matched your search
@@ -679,7 +679,7 @@ medusaIntegrationTestRunner({
|
|||||||
unit_price: 1500,
|
unit_price: 1500,
|
||||||
compare_at_unit_price: null,
|
compare_at_unit_price: null,
|
||||||
is_tax_inclusive: true,
|
is_tax_inclusive: true,
|
||||||
title: "S / Black",
|
title: "Medusa T-Shirt",
|
||||||
quantity: 2,
|
quantity: 2,
|
||||||
tax_lines: [
|
tax_lines: [
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
@@ -714,7 +714,7 @@ medusaIntegrationTestRunner({
|
|||||||
compare_at_unit_price: null,
|
compare_at_unit_price: null,
|
||||||
is_tax_inclusive: true,
|
is_tax_inclusive: true,
|
||||||
quantity: 2,
|
quantity: 2,
|
||||||
title: "S / Black",
|
title: "Medusa T-Shirt",
|
||||||
tax_lines: [
|
tax_lines: [
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
description: "CA Default Rate",
|
description: "CA Default Rate",
|
||||||
@@ -729,7 +729,7 @@ medusaIntegrationTestRunner({
|
|||||||
compare_at_unit_price: null,
|
compare_at_unit_price: null,
|
||||||
is_tax_inclusive: true,
|
is_tax_inclusive: true,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
title: "S / White",
|
title: "Medusa T-Shirt",
|
||||||
tax_lines: [
|
tax_lines: [
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
description: "CA Default Rate",
|
description: "CA Default Rate",
|
||||||
@@ -1603,11 +1603,11 @@ medusaIntegrationTestRunner({
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
items: expect.arrayContaining([
|
items: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
title: "2-pack",
|
subtitle: "2-pack",
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
title: "3-pack",
|
subtitle: "3-pack",
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
|
|||||||
@@ -1668,8 +1668,8 @@ medusaIntegrationTestRunner({
|
|||||||
is_custom_price: false,
|
is_custom_price: false,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
requires_shipping: false, // product doesn't have a shipping profile nor inventory items that require shipping
|
requires_shipping: false, // product doesn't have a shipping profile nor inventory items that require shipping
|
||||||
subtitle: "Test product",
|
title: "Test product",
|
||||||
title: "Test variant",
|
subtitle: "Test variant",
|
||||||
unit_price: 3000,
|
unit_price: 3000,
|
||||||
updated_at: expect.any(Date),
|
updated_at: expect.any(Date),
|
||||||
}),
|
}),
|
||||||
@@ -1719,8 +1719,8 @@ medusaIntegrationTestRunner({
|
|||||||
is_custom_price: false,
|
is_custom_price: false,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
requires_shipping: false,
|
requires_shipping: false,
|
||||||
subtitle: "Test product",
|
title: "Test product",
|
||||||
title: "Test variant",
|
subtitle: "Test variant",
|
||||||
unit_price: 2000,
|
unit_price: 2000,
|
||||||
updated_at: expect.any(Date),
|
updated_at: expect.any(Date),
|
||||||
}),
|
}),
|
||||||
@@ -1841,7 +1841,8 @@ medusaIntegrationTestRunner({
|
|||||||
unit_price: 3000,
|
unit_price: 3000,
|
||||||
is_tax_inclusive: true,
|
is_tax_inclusive: true,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
title: "Test variant",
|
title: "Test product",
|
||||||
|
subtitle: "Test variant",
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
})
|
})
|
||||||
@@ -2093,7 +2094,8 @@ medusaIntegrationTestRunner({
|
|||||||
unit_price: 1500,
|
unit_price: 1500,
|
||||||
is_tax_inclusive: true,
|
is_tax_inclusive: true,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
title: "Test variant",
|
title: "Test product",
|
||||||
|
subtitle: "Test variant",
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
})
|
})
|
||||||
@@ -2322,7 +2324,7 @@ medusaIntegrationTestRunner({
|
|||||||
unit_price: 3000,
|
unit_price: 3000,
|
||||||
is_tax_inclusive: true,
|
is_tax_inclusive: true,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
title: "Test variant",
|
title: "Test product",
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
})
|
})
|
||||||
@@ -2478,7 +2480,7 @@ medusaIntegrationTestRunner({
|
|||||||
unit_price: 3000,
|
unit_price: 3000,
|
||||||
is_tax_inclusive: true,
|
is_tax_inclusive: true,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
title: "Test variant",
|
title: "Test product",
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
})
|
})
|
||||||
@@ -2566,7 +2568,7 @@ medusaIntegrationTestRunner({
|
|||||||
quantity: 1,
|
quantity: 1,
|
||||||
unit_price: 5000,
|
unit_price: 5000,
|
||||||
is_custom_price: true,
|
is_custom_price: true,
|
||||||
title: "Test variant",
|
title: "Test product",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
@@ -2600,7 +2602,7 @@ medusaIntegrationTestRunner({
|
|||||||
unit_price: 5000,
|
unit_price: 5000,
|
||||||
is_custom_price: true,
|
is_custom_price: true,
|
||||||
quantity: 2,
|
quantity: 2,
|
||||||
title: "Test variant",
|
title: "Test product",
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -776,7 +776,7 @@ medusaIntegrationTestRunner({
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
unit_price: 1500,
|
unit_price: 1500,
|
||||||
quantity: 2,
|
quantity: 2,
|
||||||
title: "S / Black",
|
title: product.title,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
subtotal: 3000,
|
subtotal: 3000,
|
||||||
@@ -805,12 +805,12 @@ medusaIntegrationTestRunner({
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
unit_price: 1500,
|
unit_price: 1500,
|
||||||
quantity: 2,
|
quantity: 2,
|
||||||
title: "S / Black",
|
title: product.title,
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
unit_price: 1500,
|
unit_price: 1500,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
title: "S / Black",
|
title: product.title,
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
subtotal: 4500,
|
subtotal: 4500,
|
||||||
|
|||||||
@@ -246,8 +246,8 @@ medusaIntegrationTestRunner({
|
|||||||
}),
|
}),
|
||||||
items: expect.arrayContaining([
|
items: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
title: "Test variant",
|
title: "Test product",
|
||||||
subtitle: "Test product",
|
subtitle: "Test variant",
|
||||||
product_title: "Test product",
|
product_title: "Test product",
|
||||||
product_description: null,
|
product_description: null,
|
||||||
product_subtitle: null,
|
product_subtitle: null,
|
||||||
@@ -313,8 +313,8 @@ medusaIntegrationTestRunner({
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
title: "Variant variable",
|
title: "Another product",
|
||||||
subtitle: "Another product",
|
subtitle: "Variant variable",
|
||||||
raw_unit_price: expect.objectContaining({
|
raw_unit_price: expect.objectContaining({
|
||||||
value: "200",
|
value: "200",
|
||||||
}),
|
}),
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ function ClaimOutboundItem({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<Text as="div" className="text-ui-fg-subtle txt-small">
|
<Text as="div" className="text-ui-fg-subtle txt-small">
|
||||||
{previewItem.product_title}
|
{previewItem.subtitle}
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+1
-1
@@ -137,7 +137,7 @@ function OrderEditItem({ item, currencyCode, orderId }: OrderEditItemProps) {
|
|||||||
{item.variant_sku && <span>({item.variant_sku})</span>}
|
{item.variant_sku && <span>({item.variant_sku})</span>}
|
||||||
</div>
|
</div>
|
||||||
<Text as="div" className="text-ui-fg-subtle txt-small">
|
<Text as="div" className="text-ui-fg-subtle txt-small">
|
||||||
{item.product_title}
|
{item.subtitle}
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ function ExchangeOutboundItem({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<Text as="div" className="text-ui-fg-subtle txt-small">
|
<Text as="div" className="text-ui-fg-subtle txt-small">
|
||||||
{previewItem.product_title}
|
{previewItem.subtitle}
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ export function prepareLineItemData(data: PrepareLineItemDataInput) {
|
|||||||
|
|
||||||
let lineItem: any = {
|
let lineItem: any = {
|
||||||
quantity: item?.quantity,
|
quantity: item?.quantity,
|
||||||
title: variant?.title ?? item?.title,
|
title: variant?.product?.title ?? item?.title,
|
||||||
subtitle: variant?.product?.title ?? item?.subtitle,
|
subtitle: variant?.title ?? item?.subtitle,
|
||||||
thumbnail: variant?.product?.thumbnail ?? item?.thumbnail,
|
thumbnail: variant?.product?.thumbnail ?? item?.thumbnail,
|
||||||
|
|
||||||
product_id: variant?.product?.id ?? item?.product_id,
|
product_id: variant?.product?.id ?? item?.product_id,
|
||||||
|
|||||||
Reference in new issue
Block a user