Issue: Using fulfillmentService.location.id for variants inventoryQuantities, "sold out" on the pdp

Topic summary

A developer is experiencing an inventory display discrepancy when creating product variants through Shopify’s GraphQL API (2024-10 version).

Setup Process:

  • Created a fulfillmentService using fulfillmentServiceCreate mutation
  • Used productVariantsBulkCreate API to create product variants
  • Set the inventoryQuantities.locationId to the fulfillmentService.location.id from the created fulfillment service
  • Assigned inventory quantity of 9999 to the variants

The Problem:

  • Backend/admin panel correctly displays inventory as “9999”
  • Product detail page (PDP) incorrectly shows “Sold Out” to customers
  • Screenshots confirm the mismatch between backend inventory data and frontend display

Status: The issue remains unresolved. The developer is seeking an explanation for why inventory appears correctly in the backend but fails to display on the storefront, and looking for a solution to fix the frontend display.

Summarized with AI on November 2. AI used: claude-sonnet-4-5-20250929.

I am creating a complex Shopify application.

Using the 2024-10 version of the GraphQL API, I created a fulfillmentService using the following mutation:

mutation fulfillmentServiceCreate($name: String!, $callbackUrl: URL!, $inventoryManagement:Boolean!, $permitsSkuSharing:Boolean!) {
            fulfillmentServiceCreate(name: $name, callbackUrl: $callbackUrl, inventoryManagement:$inventoryManagement, permitsSkuSharing:$permitsSkuSharing) {
              fulfillmentService {
                id
                serviceName
                callbackUrl
                fulfillmentOrdersOptIn
                permitsSkuSharing
                handle
                inventoryManagement
                location {
                    id
                    legacyResourceId
                }
              }
              userErrors {
                field
                message
              }
            }
          }

then, i get a[details=Show More]
fulfillmentService.localtion.id
[/details]

Next, I used the Bulk Product Variant Creation API:

mutation productVariantsBulkCreate($productId: ID!, $variants: [ProductVariantsBulkInput!]!, $strategy: ProductVariantsBulkCreateStrategy, $media: [CreateMediaInput!]) {
            productVariantsBulkCreate(productId: $productId, media: $media, variants: $variants, strategy: $strategy) {
              userErrors {
                field
                message
              }
              
              product {
                id
                options {
                  id
                  name
                  values
                  position
                  optionValues {
                    id
                    name
                    hasVariants
                  }
                }
              }
              productVariants {
                id
                title
                selectedOptions {
                  name
                  value
                }
              }
            }
          }

For the $variants parameter, I set the locationId of inventoryQuantities to the fulfillmentService.localtion.id of the :

After completing these steps:

  1. In the backend, the inventory shows “9999” correctly.
  2. However, on the product detail page, it still displays “Sold Out.”

Screenshots of the issue:

微信截图_20250107184010.jpg

Question:
Why is the inventory showing correctly in the backend but displaying “Sold Out” on the product page? Is there a solution to this issue?