younifyd
Menu

productOptionUpdate

Updates an option on a product, such as size, color, or material. Each option includes a name, position, and a list of values.

Use it in a workflow

  1. Add a step and choose the Shopify connector.
  2. Pick the productOptionUpdate action (under Product).
  3. Fill in the fields below, then reference the result from later steps as {{productoptionupdate.response.data}}.

Query

This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
mutation ProductOptionUpdate($option: OptionUpdateInput!, $productId: ID!, $optionValuesToAdd: [OptionValueCreateInput!], $optionValuesToUpdate: [OptionValueUpdateInput!], $optionValuesToDelete: [ID!], $variantStrategy: ProductOptionUpdateVariantStrategy) {
  productOptionUpdate(
    option: $option
    productId: $productId
    optionValuesToAdd: $optionValuesToAdd
    optionValuesToUpdate: $optionValuesToUpdate
    optionValuesToDelete: $optionValuesToDelete
    variantStrategy: $variantStrategy
  ) {
    product {
      availablePublicationsCount {
        count
        precision
      }
      bodyHtml
      bundleConsolidatedOptions {
        name
        selections
      }
      category {
        ancestorIds
        childrenIds
        fullName
        id
        isArchived
        isLeaf
        isRoot
        level
        name
        parentId
      }
      combinedListing {
        parentProduct
      }
      combinedListingRole
      compareAtPriceRange {
        maxVariantCompareAtPrice
        minVariantCompareAtPrice
      }
      createdAt
      customProductType
      defaultCursor
      descriptionHtml
      descriptionPlainSummary
      featuredImage {
        altText
        height
        id
        originalSrc
        src
        thumbhash
        width
      }
      featuredMedia {
        alt
        id
        mediaContentType
        mediaErrors
        mediaWarnings
        preview
        status
      }
      feedback {
        appFeedback
        details
        summary
      }
      giftCardSettings {
        crossCurrencyRedeemable
        issuanceCurrency
      }
      giftCardTemplateSuffix
      handle
      hasOnlyDefaultVariant
      hasOutOfStockVariants
      hasVariantsThatRequiresComponents
      id
      isGiftCard
      legacyResourceId
      mediaCount {
        count
        precision
      }
      onlineStorePreviewUrl
      onlineStoreUrl
      priceRange {
        maxVariantPrice
        minVariantPrice
      }
      priceRangeV2 {
        maxVariantPrice
        minVariantPrice
      }
      productCategory {
        productTaxonomyNode
      }
      productComponentsCount {
        count
        precision
      }
      productType
      publishedAt
      publishedOnCurrentChannel
      publishedOnCurrentPublication
      requiresSellingPlan
      resourcePublicationOnCurrentPublication {
        isPublished
        publication
        publishDate
        publishable
      }
      sellingPlanGroupCount
      sellingPlanGroupsCount {
        count
        precision
      }
      seo {
        description
        title
      }
      standardizedProductType {
        productTaxonomyNode
      }
      status
      storefrontId
      tags
      templateSuffix
      title
      totalInventory
      totalVariants
      tracksInventory
      updatedAt
      variantsCount {
        count
        precision
      }
      vendor
    }
    userErrors {
      code
      field
      message
    }
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

optionobjectrequired

Option to update.

idstringrequired
namestring
positionnumber
linkedMetafieldobject2 fields
productIdstringrequired

The ID of the Product the Option belongs to.

optionValuesToAddarray<object>

New option values to create.

namestring
linkedMetafieldValuestring
optionValuesToUpdatearray<object>

Existing option values to update.

idstringrequired
namestring
linkedMetafieldValuestring
optionValuesToDeletearray<string>

IDs of the existing option values to delete.

variantStrategystring

The strategy defines which behavior the mutation should observe regarding variants, such as creating variants or deleting them in response to option values to add or to delete. If not provided or set to null, the strategy `LEAVE_AS_IS` will be used.

One ofLEAVE_AS_ISMANAGE

json
{
  "option": {
    "id": "string",
    "name": "string",
    "position": 0,
    "linkedMetafield": {
      "namespace": "string",
      "key": "string"
    }
  },
  "productId": "string",
  "optionValuesToAdd": [
    {
      "name": "string",
      "linkedMetafieldValue": "string"
    }
  ],
  "optionValuesToUpdate": [
    {
      "id": "string",
      "name": "string",
      "linkedMetafieldValue": "string"
    }
  ],
  "optionValuesToDelete": [
    "string"
  ],
  "variantStrategy": "LEAVE_AS_IS"
}

Response

Read the result with {{productoptionupdate.response.data.data.productOptionUpdate}}. If the API returns errors, the step fails and they are at {{productoptionupdate.response.data.errors}}.

productobject
availablePublicationsCountobject2 fields
bodyHtmlstring
bundleConsolidatedOptionsarray<object>
categoryobject10 fields
combinedListingobject1 fields
combinedListingRolestring

One ofPARENTCHILD

compareAtPriceRangeobject2 fields
createdAtstring
customProductTypestring
defaultCursorstring
descriptionHtmlstring
descriptionPlainSummarystring
featuredImageobject7 fields
featuredMediaobject7 fields
feedbackobject3 fields
giftCardSettingsobject2 fields
giftCardTemplateSuffixstring
handlestring
hasOnlyDefaultVariantboolean
hasOutOfStockVariantsboolean
hasVariantsThatRequiresComponentsboolean
idstring
isGiftCardboolean
legacyResourceIdstring
mediaCountobject2 fields
onlineStorePreviewUrlstring
onlineStoreUrlstring
priceRangeobject2 fields
priceRangeV2object2 fields
productCategoryobject1 fields
productComponentsCountobject2 fields
productTypestring
publishedAtstring
publishedOnCurrentChannelboolean
publishedOnCurrentPublicationboolean
requiresSellingPlanboolean
resourcePublicationOnCurrentPublicationobject4 fields
sellingPlanGroupCountnumber
sellingPlanGroupsCountobject2 fields
seoobject2 fields
userErrorsarray<object>
codeobject
fieldobject
messageobject

Need more? See the Shopify guide for connection setup and behaviour shared by every action.