Order Actions: Set an order metafield value

The Set an Order Metafield Value Action enables merchants to assign specific information to order metafields within their Shopify store. This functionality is pivotal for augmenting orders with custom data that is not covered by Shopify's standard order attributes.

Configuring the Action

Field Name Description
Metafield Selection Type Options include manually entering a Namespace/Key or choosing from existing Metafield Definitions within the store.
Namespace Mandatory if selecting Namespace/Key. Represents the metafield's namespace. Example: customer_preferences
Key Mandatory if selecting Namespace/Key. Represents the metafield's key. Example: favorite_color
Value Type Required. Choose the correct data type for the metafield's value from options like text, integer, date, and more listed below.
Value The actual value to assign. It must be consistent with the selected Value Type.

Value Types

Value Types

Value Type Description Example
Value Type Description Example
Single Line Text Field A simple text input that should be used for single-line entries. This is a single line text
Multi Line Text Field Text input for paragraphs or multiple lines of text. This is
multiple lines
Integer A whole number value. 42
Decimal A number that includes a decimal point. 3.14
Date Uses the YYYY-MM-DD format. 2023-04-21
Date/Time Values must be in ISO 8601 format without a timezone. 2023-04-21T15:30:00
Boolean Takes either 'TRUE' or 'FALSE'. TRUE
Page Reference An ID starting with gid://shopify/ for a Shopify page. gid://shopify/Page/123456789
Product Reference An ID starting with gid://shopify/ for a Shopify product. gid://shopify/Product/987654321
Variant Reference An ID starting with gid://shopify/ for a Shopify product variant. gid://shopify/ProductVariant/12345678910
File Reference An ID starting with gid://shopify/ for a file uploaded to Shopify's Files section. gid://shopify/File/12345678910
URL A web address. https://www.example.com
Color A HEX color code value such as #000000 for black. #FF5733
Weight A weight value, which requires specifying a unit. Units: Kilograms
Weight Value: 5
Volume A volume value, which requires specifying a unit. Units: Liters
Volume Value: 2
Dimension A dimension value, which requires specifying a unit. Units: Centimeters
Dimension Value: 100
Rating A rating value, specified within a minimum and maximum scale. Rating scale minimum: 0
Rating scale maximum: 100
Rating Value: 85
JSON Value A JSON-formatted string, rendered in a script tag when output in themes. [{"k":"v1"},{"k":"v2"}]
Single Line Text Field (List) Allows adding and removing single-line text values from a list. Multiple values are separated with commas. Duplicates are ignored by default. Value 1, Value 2, Value 3
Integer (List) Allows adding and removing integer values from a list. Separate multiple values with commas. Duplicates are ignored by default. 1, 2, 3
Decimal (List) Allows adding and removing decimal values from a list. Separate multiple values with commas. Duplicates are ignored by default. 1.1, 2.2, 3.3
Date (List) Allows adding and removing date values (in YYYY-MM-DD format) from a list. Separate multiple values with commas. Duplicates are ignored by default. 2023-01-01, 2023-12-31
Date/Time (List) Allows adding and removing date/time values (in ISO 8601 format) from a list. Separate multiple values with commas. Duplicates are ignored by default. 2023-01-01T12:00:00, 2023-12-31T18:30:00
Page Reference (List) Allows adding and removing page reference values (with IDs starting with gid://shopify/) from a list. Separate multiple values with commas. Duplicates are ignored by default. gid://shopify/Page/123456789, gid://shopify/Page/987654321
Product Reference (List) Allows adding and removing product reference values (with IDs starting with gid://shopify/) from a list. Separate multiple values with commas. Duplicates are ignored by default. gid://shopify/Product/987654321, gid://shopify/Product/123456789
Variant Reference (List) Allows adding and removing variant reference values (with IDs starting with gid://shopify/) from a list. Separate multiple values with commas. Duplicates are ignored by default. gid://shopify/ProductVariant/12345678910, gid://shopify/ProductVariant/10987654321
File Reference (List) Allows adding and removing file reference values (with IDs starting with gid://shopify/) from a list. Separate multiple values with commas. Duplicates are ignored by default. gid://shopify/File/12345678910, gid://shopify/File/10987654321
URL (List) Allows adding and removing URL values from a list. Separate multiple values with commas. Duplicates are ignored by default. https://www.example1.com, https://www.example2.com
Color (List) Allows adding and removing color values (in HEX code) from a list. Separate multiple values with commas. Duplicates are ignored by default. #FF5733, #33FF57
Weight (List) Allows adding and removing weight values from a list. Specify units for each value. Separate multiple values with commas. Duplicates are ignored by default. 5 Kilograms, 10 Pounds
Volume (List) Allows adding and removing volume values from a list. Each value must be in the format of "quantity unit". Valid units: ml, cl, l, m3, us_fl_oz, us_pt, us_qt, us_gal, imp_fl_oz, imp_pt, imp_qt, imp_gal. Separate multiple values with commas. Duplicates are ignored by default. 1.5 us_gal, 10 ml
Dimension (List) Allows adding and removing dimension values from a list. Each value must be in the format of "quantity unit". Valid units: mm, cm, m, in, ft, yd. Separate multiple values with commas. Duplicates are ignored by default.
12 in, 120 mm
Legacy String Deprecated; Used for simple text strings. This is a legacy string
Legacy Integer Deprecated; Used for whole number values. 12345
Legacy JSON Deprecated; Used for data in JSON format. {"legacy_key":"legacy_value"}

Credit Cost

Utilizing the Set an Order Metafield Value Action incurs one action credit under Lite plans. There is no credit cost for those on Unlimited plans.

Custom Actions

Integration of the Set an Order Metafield Value Action into Custom Actions is seamlessly supported. Detailed information and illustrative examples are accessible in the documentation.