A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://shopify.dev/docs/apps/build/custom-data/metafields/working-with-custom-ids below:

Working with custom IDs

Working with custom IDs

You can create custom IDs when you need a reliable unique identifier to match resources across multiple shops and/or systems (e.g. ERPs, CRMs, PIMs). This guide shows you how to create and manage custom IDs using Metafields in the GraphQL Admin API.

Any developer who uses external systems (e.g., PIM, ERP) and wants to create a mapping of identifiers to manage data migration and synchronization with Shopify.

You can create an ID metafield definition using the GraphQL Admin API's createMetafieldDefinition mutation

The following example creates a pinned id metafield definition for the product owner type:

Add a metafield to the corresponding resource type using the id type with the namespace and key for your definition. For example, add a metafield to a new product if you created a product metafield definition.

Add a metafield to the corresponding resource type using the id type with the namespace and key from your definition. In the following example, add a metafield to an existing product if you've created a product metafield definition.

After you've added the Custom ID metafield to a resource, you can look up that resource by its custom ID. Here are some examples of available GraphQL Admin API queries:

You can also update or create some resources by referencing their Custom ID. This is available for products via the productSet mutation, and customers via customerSet. When the identifier argument for these mutations includes a custom ID, they will first look up a matching record. If one exists, the mutation will update it. Otherwise, the mutation will attempt to create a new record with the provided inputs.

The following example looks up a product using the Custom ID format from Step 4 and updates its title:

The following example demonstrates how productSet creates a new product when the Custom ID doesn't match existing products:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4