@anker-in/shopify-sdk 0.1.1-beta.15 → 0.1.1-beta.16
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/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1074,8 +1074,6 @@ var updateCartDeliveryOptionsMutation = (
|
|
|
1074
1074
|
${cartFragment}
|
|
1075
1075
|
`
|
|
1076
1076
|
);
|
|
1077
|
-
|
|
1078
|
-
// src/api/product/normalize.ts
|
|
1079
1077
|
var normalizeSellingPlan = ({ edges }) => {
|
|
1080
1078
|
return edges?.map(({ node }) => node);
|
|
1081
1079
|
};
|
|
@@ -1103,12 +1101,14 @@ function normalizeVariant(variant) {
|
|
|
1103
1101
|
amount: variant.compareAtPriceV2.amount,
|
|
1104
1102
|
currencyCode: variant.compareAtPriceV2.currencyCode
|
|
1105
1103
|
} : void 0;
|
|
1104
|
+
const isSoldOut = Number(price.amount) === shopifyCore.SOLD_OUT_PRICE;
|
|
1106
1105
|
const metafields = normalizeMetafields(variant.metafields || []);
|
|
1107
1106
|
return {
|
|
1108
1107
|
id: variant.id,
|
|
1109
1108
|
title: variant.title,
|
|
1110
1109
|
sku: variant.sku || "",
|
|
1111
|
-
|
|
1110
|
+
// 如果价格为售罄价格,强制设置 availableForSale 为 false
|
|
1111
|
+
availableForSale: isSoldOut ? false : variant.availableForSale || false,
|
|
1112
1112
|
quantityAvailable: variant.quantityAvailable,
|
|
1113
1113
|
selectedOptions: variant.selectedOptions || [],
|
|
1114
1114
|
price,
|
|
@@ -1607,14 +1607,17 @@ async function updateCartLines(client, options) {
|
|
|
1607
1607
|
if (!cartId) {
|
|
1608
1608
|
throw new Error("Invalid input used for this operation: Miss cartId");
|
|
1609
1609
|
}
|
|
1610
|
+
const metafieldParams = constructMetafieldIdentifiersQueryParams(
|
|
1611
|
+
metafieldIdentifiers,
|
|
1612
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
1613
|
+
);
|
|
1614
|
+
console.log("update-cart-lines metafieldIdentifiers:", metafieldIdentifiers);
|
|
1615
|
+
console.log("update-cart-lines metafieldParams:", metafieldParams);
|
|
1610
1616
|
try {
|
|
1611
1617
|
const data = await client.query(updateCartItemsMutation, {
|
|
1612
1618
|
cartId,
|
|
1613
1619
|
lines,
|
|
1614
|
-
...
|
|
1615
|
-
metafieldIdentifiers,
|
|
1616
|
-
client.getConfig().getMetafieldNamespacePrefix()
|
|
1617
|
-
)
|
|
1620
|
+
...metafieldParams
|
|
1618
1621
|
});
|
|
1619
1622
|
let maxNum;
|
|
1620
1623
|
if (data?.cartLinesUpdate?.userErrors?.length) {
|