Shopify · Arazzo Workflow

Shopify Restock a Product Variant

Version 1.0.0

Read a variant to find its inventory item, resolve a location, and set the available quantity.

1 workflow 1 source API 1 provider
View Spec View on GitHub CommerceEcommercePaymentsRetailShopping CartT1ArazzoWorkflows

Provider

shopify

Workflows

restock-product-variant
Set a variant's available stock at the primary location by resolving its inventory item.
Resolves a variant's inventory item from the product, resolves the primary location, and sets the variant's available quantity there.
3 steps inputs: available, productId, variantId outputs: available, inventoryItemId, locationId
1
resolveVariant
listProductVariants
List the product's variants and select the matching variant so its inventory item id can be used for the stock update.
2
resolveLocation
listLocations
List the store's locations and use the first location as the target.
3
setLevel
setInventoryLevel
Set the available quantity for the variant's inventory item at the resolved location.

Source API Descriptions

Arazzo Workflow Specification

shopify-restock-product-variant-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Shopify Restock a Product Variant
  summary: Read a variant to find its inventory item, resolve a location, and set the available quantity.
  description: >-
    Restocks a specific product variant by quantity. The workflow lists the
    product's variants to resolve the variant's inventory item, lists locations
    to resolve the target location, and sets the available quantity for that
    inventory item at that location. This is the variant-centric entry point for
    keeping stock accurate. Every step spells out its request inline so the flow
    can be read and executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: shopifyAdminRestApi
  url: ../openapi/shopify-admin-rest-api-openapi.yml
  type: openapi
workflows:
- workflowId: restock-product-variant
  summary: Set a variant's available stock at the primary location by resolving its inventory item.
  description: >-
    Resolves a variant's inventory item from the product, resolves the primary
    location, and sets the variant's available quantity there.
  inputs:
    type: object
    required:
    - productId
    - variantId
    - available
    properties:
      productId:
        type: integer
        description: The product ID owning the variant.
      variantId:
        type: integer
        description: The variant ID to restock (matched within the product's variants).
      available:
        type: integer
        description: The absolute available quantity to set.
  steps:
  - stepId: resolveVariant
    description: >-
      List the product's variants and select the matching variant so its
      inventory item id can be used for the stock update.
    operationId: listProductVariants
    parameters:
    - name: product_id
      in: path
      value: $inputs.productId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      inventoryItemId: $response.body#/variants/0/inventory_item_id
  - stepId: resolveLocation
    description: List the store's locations and use the first location as the target.
    operationId: listLocations
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      locationId: $response.body#/locations/0/id
  - stepId: setLevel
    description: >-
      Set the available quantity for the variant's inventory item at the
      resolved location.
    operationId: setInventoryLevel
    requestBody:
      contentType: application/json
      payload:
        inventory_item_id: $steps.resolveVariant.outputs.inventoryItemId
        location_id: $steps.resolveLocation.outputs.locationId
        available: $inputs.available
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      available: $response.body#/inventory_level/available
      inventoryItemId: $response.body#/inventory_level/inventory_item_id
  outputs:
    inventoryItemId: $steps.resolveVariant.outputs.inventoryItemId
    locationId: $steps.resolveLocation.outputs.locationId
    available: $steps.setLevel.outputs.available