@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.mjs
CHANGED
|
@@ -141,7 +141,7 @@ function normalizeAddToCartLines(lines) {
|
|
|
141
141
|
const variant = line.variant;
|
|
142
142
|
const product = variant.product;
|
|
143
143
|
const quantity = line.quantity || 1;
|
|
144
|
-
const originalPrice = variant.
|
|
144
|
+
const originalPrice = variant.price?.amount ? Number(variant.price.amount) : 0;
|
|
145
145
|
const finalPrice = variant.finalPrice?.amount ? Number(variant.finalPrice.amount) : originalPrice;
|
|
146
146
|
const subtotalAmount = originalPrice * quantity;
|
|
147
147
|
const totalAmount = finalPrice * quantity;
|
|
@@ -189,14 +189,13 @@ function createMockCartFromLines(lines, existingCart) {
|
|
|
189
189
|
const normalizedLines = normalizeAddToCartLines(lines);
|
|
190
190
|
const subtotalPrice = normalizedLines.reduce((sum, line) => sum + line.subtotalAmount, 0);
|
|
191
191
|
const totalPrice = normalizedLines.reduce((sum, line) => sum + line.totalAmount, 0);
|
|
192
|
-
console.log("lines createMockCartFromLines4444", normalizedLines, lines);
|
|
193
192
|
const currency = lines[0]?.variant?.price?.currencyCode;
|
|
194
193
|
return {
|
|
195
194
|
id: existingCart?.id || "temp-cart-id",
|
|
196
195
|
customerId: existingCart?.customerId,
|
|
197
196
|
email: existingCart?.email,
|
|
198
197
|
createdAt: existingCart?.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
199
|
-
currency: existingCart?.currency
|
|
198
|
+
currency: existingCart?.currency || { code: currency },
|
|
200
199
|
taxesIncluded: existingCart?.taxesIncluded,
|
|
201
200
|
lineItems: normalizedLines,
|
|
202
201
|
totalLineItemsDiscount: 0,
|