@anker-in/shopify-react 0.1.1-beta.26 → 0.1.1-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/index.js +2 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -3
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -3
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.js +2 -3
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +2 -3
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/hooks/index.mjs
CHANGED
|
@@ -69,7 +69,7 @@ function normalizeAddToCartLines(lines) {
|
|
|
69
69
|
const variant = line.variant;
|
|
70
70
|
const product = variant.product;
|
|
71
71
|
const quantity = line.quantity || 1;
|
|
72
|
-
const originalPrice = variant.
|
|
72
|
+
const originalPrice = variant.price?.amount ? Number(variant.price.amount) : 0;
|
|
73
73
|
const finalPrice = variant.finalPrice?.amount ? Number(variant.finalPrice.amount) : originalPrice;
|
|
74
74
|
const subtotalAmount = originalPrice * quantity;
|
|
75
75
|
const totalAmount = finalPrice * quantity;
|
|
@@ -117,14 +117,13 @@ function createMockCartFromLines(lines, existingCart) {
|
|
|
117
117
|
const normalizedLines = normalizeAddToCartLines(lines);
|
|
118
118
|
const subtotalPrice = normalizedLines.reduce((sum, line) => sum + line.subtotalAmount, 0);
|
|
119
119
|
const totalPrice = normalizedLines.reduce((sum, line) => sum + line.totalAmount, 0);
|
|
120
|
-
console.log("lines createMockCartFromLines4444", normalizedLines, lines);
|
|
121
120
|
const currency = lines[0]?.variant?.price?.currencyCode;
|
|
122
121
|
return {
|
|
123
122
|
id: existingCart?.id || "temp-cart-id",
|
|
124
123
|
customerId: existingCart?.customerId,
|
|
125
124
|
email: existingCart?.email,
|
|
126
125
|
createdAt: existingCart?.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
127
|
-
currency: existingCart?.currency
|
|
126
|
+
currency: existingCart?.currency || { code: currency },
|
|
128
127
|
taxesIncluded: existingCart?.taxesIncluded,
|
|
129
128
|
lineItems: normalizedLines,
|
|
130
129
|
totalLineItemsDiscount: 0,
|