@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.js
CHANGED
|
@@ -78,7 +78,7 @@ function normalizeAddToCartLines(lines) {
|
|
|
78
78
|
const variant = line.variant;
|
|
79
79
|
const product = variant.product;
|
|
80
80
|
const quantity = line.quantity || 1;
|
|
81
|
-
const originalPrice = variant.
|
|
81
|
+
const originalPrice = variant.price?.amount ? Number(variant.price.amount) : 0;
|
|
82
82
|
const finalPrice = variant.finalPrice?.amount ? Number(variant.finalPrice.amount) : originalPrice;
|
|
83
83
|
const subtotalAmount = originalPrice * quantity;
|
|
84
84
|
const totalAmount = finalPrice * quantity;
|
|
@@ -126,14 +126,13 @@ function createMockCartFromLines(lines, existingCart) {
|
|
|
126
126
|
const normalizedLines = normalizeAddToCartLines(lines);
|
|
127
127
|
const subtotalPrice = normalizedLines.reduce((sum, line) => sum + line.subtotalAmount, 0);
|
|
128
128
|
const totalPrice = normalizedLines.reduce((sum, line) => sum + line.totalAmount, 0);
|
|
129
|
-
console.log("lines createMockCartFromLines4444", normalizedLines, lines);
|
|
130
129
|
const currency = lines[0]?.variant?.price?.currencyCode;
|
|
131
130
|
return {
|
|
132
131
|
id: existingCart?.id || "temp-cart-id",
|
|
133
132
|
customerId: existingCart?.customerId,
|
|
134
133
|
email: existingCart?.email,
|
|
135
134
|
createdAt: existingCart?.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
136
|
-
currency: existingCart?.currency
|
|
135
|
+
currency: existingCart?.currency || { code: currency },
|
|
137
136
|
taxesIncluded: existingCart?.taxesIncluded,
|
|
138
137
|
lineItems: normalizedLines,
|
|
139
138
|
totalLineItemsDiscount: 0,
|