@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/index.js
CHANGED
|
@@ -149,7 +149,7 @@ function normalizeAddToCartLines(lines) {
|
|
|
149
149
|
const variant = line.variant;
|
|
150
150
|
const product = variant.product;
|
|
151
151
|
const quantity = line.quantity || 1;
|
|
152
|
-
const originalPrice = variant.
|
|
152
|
+
const originalPrice = variant.price?.amount ? Number(variant.price.amount) : 0;
|
|
153
153
|
const finalPrice = variant.finalPrice?.amount ? Number(variant.finalPrice.amount) : originalPrice;
|
|
154
154
|
const subtotalAmount = originalPrice * quantity;
|
|
155
155
|
const totalAmount = finalPrice * quantity;
|
|
@@ -197,14 +197,13 @@ function createMockCartFromLines(lines, existingCart) {
|
|
|
197
197
|
const normalizedLines = normalizeAddToCartLines(lines);
|
|
198
198
|
const subtotalPrice = normalizedLines.reduce((sum, line) => sum + line.subtotalAmount, 0);
|
|
199
199
|
const totalPrice = normalizedLines.reduce((sum, line) => sum + line.totalAmount, 0);
|
|
200
|
-
console.log("lines createMockCartFromLines4444", normalizedLines, lines);
|
|
201
200
|
const currency = lines[0]?.variant?.price?.currencyCode;
|
|
202
201
|
return {
|
|
203
202
|
id: existingCart?.id || "temp-cart-id",
|
|
204
203
|
customerId: existingCart?.customerId,
|
|
205
204
|
email: existingCart?.email,
|
|
206
205
|
createdAt: existingCart?.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
207
|
-
currency: existingCart?.currency
|
|
206
|
+
currency: existingCart?.currency || { code: currency },
|
|
208
207
|
taxesIncluded: existingCart?.taxesIncluded,
|
|
209
208
|
lineItems: normalizedLines,
|
|
210
209
|
totalLineItemsDiscount: 0,
|