Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-add-product-to-custom-collection",
version: "0.0.5",
version: "0.0.6",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-add-tags",
version: "0.0.5",
version: "0.0.6",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-article",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-blog",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-custom-collection",
version: "0.0.5",
version: "0.0.6",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "shopify_developer_app-create-customer",
name: "Create Customer",
description: "Create a new customer. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customercreate)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
shopify,
Expand Down Expand Up @@ -88,6 +88,9 @@ export default {
],
},
});
if (response.customerCreate.userErrors.length > 0) {
throw new Error(response.customerCreate.userErrors[0].message);
}
$.export("$summary", `Created new customer with ID \`${response.customerCreate.customer.id}\``);
return response;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
export default {
...others,
key: "shopify_developer_app-create-metafield",
version: "0.0.6",
version: "0.0.7",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-metaobject",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "shopify_developer_app-create-order",
name: "Create Order",
description: "Creates a new order. For full order object details [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/ordercreate)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
shopify,
Expand Down Expand Up @@ -154,6 +154,9 @@ export default {
shippingLines: utils.parseJson(this.shippingLines),
},
});
if (response.orderCreate.userErrors.length > 0) {
throw new Error(response.orderCreate.userErrors[0].message);
}
$.export("$summary", `Created new order with ID \`${response.orderCreate.order.id}\``);
return response;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-page",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-product-variant",
version: "0.0.6",
version: "0.0.7",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-product",
version: "0.0.5",
version: "0.0.6",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-smart-collection",
version: "0.0.5",
version: "0.0.6",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-delete-article",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-delete-blog",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
export default {
...others,
key: "shopify_developer_app-delete-metafield",
version: "0.0.6",
version: "0.0.7",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-delete-page",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-get-articles",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const {

export default {
key: "shopify_developer_app-get-metafields",
version: "0.0.6",
version: "0.0.7",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-get-metaobjects",
version: "0.0.6",
version: "0.0.7",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "shopify_developer_app-get-order",
name: "Get Order",
description: "Retrieve an order by specifying the order ID. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/queries/order)",
version: "0.0.3",
version: "0.0.4",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-get-pages",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-search-custom-collection-by-name",
version: "0.0.5",
version: "0.0.6",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "shopify_developer_app-search-customers",
name: "Search for Customers",
description: "Search for a customer or a list of customers. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/queries/customers)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-search-product-variant",
version: "0.0.5",
version: "0.0.6",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-search-products",
version: "0.0.5",
version: "0.0.6",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-update-article",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "shopify_developer_app-update-customer",
name: "Update Customer",
description: "Update a existing customer. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customerupdate)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down Expand Up @@ -107,6 +107,9 @@ export default {
metafields,
},
});
if (response.customerUpdate.userErrors.length > 0) {
throw new Error(response.customerUpdate.userErrors[0].message);
}
$.export("$summary", `Updated customer \`${response.customerUpdate.customer.email || response.customerUpdate.customer.firstName}\` with ID \`${response.customerUpdate.customer.id}\``);
return response;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-update-inventory-level",
version: "0.0.5",
version: "0.0.6",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
export default {
...others,
key: "shopify_developer_app-update-metafield",
version: "0.0.6",
version: "0.0.7",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-update-metaobject",
version: "0.0.8",
version: "0.0.9",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-update-page",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-update-product-variant",
version: "0.0.7",
version: "0.0.8",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "shopify_developer_app-update-product",
name: "Update Product",
description: "Update an existing product. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/productupdate)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down Expand Up @@ -64,12 +64,6 @@ export default {
description: "The custom product properties. For example, Size, Color, and Material. Each product can have up to 3 options and each option value can be up to 255 characters. Product variants are made of up combinations of option values. Options cannot be created without values. To create new options, a variant with an associated option value also needs to be created. Example: `[{\"name\":\"Color\",\"values\":[{\"name\": \"Blue\"},{\"name\": \"Black\"}]},{\"name\":\"Size\",\"values\":[{\"name\": \"155\"},{\"name\": \"159\"}]}]`",
optional: true,
},
variants: {
type: "string[]",
label: "Product Variants",
description: "An array of product variants, each representing a different version of the product. The position property is read-only. The position of variants is indicated by the order in which they are listed. Example: `[{\"option1\":\"First\",\"price\":\"10.00\",\"sku\":\"123\"},{\"option1\":\"Second\",\"price\":\"20.00\",\"sku\":\"123\"}]`",
optional: true,
},
tags: {
propDefinition: [
shopify,
Expand Down Expand Up @@ -105,39 +99,27 @@ export default {
async run({ $ }) {
const metafields = await this.createMetafieldsArray(this.metafields, this.productId, "product");

const variants = [];
const variantsArray = this.shopify.parseArrayOfJSONStrings(this.variants);
for (const variant of variantsArray) {
if (variant.metafields) {
const variantMetafields = await this.createMetafieldsArray(variant.metafields, variant.id, "variants");
variants.push({
...variant,
metafields: variantMetafields,
});
continue;
}
variants.push(variant);
}

const response = await this.shopify.updateProduct({
input: {
id: this.productId,
title: this.title,
descriptionHtml: this.productDescription,
vendor: this.vendor,
productType: this.productType,
status: this.status,
images: utils.parseJson(this.images),
options: utils.parseJson(this.options),
variants,
tags: this.tags,
metafields,
metafields_global_title_tag: this.seoTitle,
metafields_global_description_tag: this.seoDescription,
handle: this.handle,
},
});

$.export("$summary", `Updated product \`${response.title}\` with id \`${response.id}\``);
if (response.productUpdate.userErrors.length > 0) {
throw new Error(response.productUpdate.userErrors[0].message);
}
$.export("$summary", `Updated product \`${response.productUpdate.product.title}\` with id \`${response.productUpdate.product.id}\``);
return response;
},
};
Loading
Loading