Skip to main content

Shopify Metafields in Journeys - REST API Block.

Overview

Shopify Metafields can be accessed inside BIK Journeys using the REST API block.

This allows you to fetch custom Shopify data stored against a customer, product, order, or market and use that information in subsequent Journey blocks.

For example, if a Shopify customer has a metafield called gender, the value can be fetched through the REST API block and used in a Message block to personalise the customer experience.


Shopify Metafields Supported

Shopify object

ID to use

Customer

{{customer.partnerCustomerId}}

Product

Select the Product Id variable

Order

Select the Order Id variable

Market

Enter the Shopify Market ID manually

The type and id values in the API request change depending on the Shopify object whose metafields you want to fetch.

Shopify Markets represent groups of customers or selling contexts for which a store can configure experiences such as pricing, currency, language, and product availability.


How to Fetch Shopify Metafields in a Journey

1. Open the Journey

Go to:

Journeys → Open an existing Journey

or create a new Journey.

Add the REST API block at the point where you want to fetch the Shopify metafield.

The REST API block is available under:

Action → REST API

BIK's REST API block supports using the API response in subsequent blocks through Journey variables.


2. Configure the REST API Block

Select:

Method: POST

Headers: Add headers if required.

Body: Select JSON and enter the request body.


3. Add the Request Body

For fetching Customer Metafields, use:

{   "appType": "BIK",   
"code": "getMetaFields",
"partner": "SHOPIFY",
"payload": {
"id": "{{customer.partnerCustomerId}}",
"type": "customer"
},
"storeId": "{{store.id}}"
}

Here:

Field

Description

appType

Identifies BIK as the application

code

getMetaFields fetches Shopify metafields

partner

Shopify integration

payload.id

ID of the Shopify object

payload.type

Object whose metafields are fetched

storeId

Shopify store associated with the Journey

For other Shopify objects

Change the payload.id and payload.type based on the requirement.

Product

type = product 
id = Product Id variable

Order

type = order 
id = Order Id variable

Market

type = market 
id = Shopify Market ID

For Market metafields, the Market ID needs to be entered manually.


4. Add a Sample Response

In the Response section of the REST API block, add the expected response.

Example:

{   "data": {     
"gender": ""
},
"response": {
"gender": ""
},
"status": 200,
"success": true
}

The sample response helps BIK identify the response keys and make them available as variables in subsequent Journey blocks.


5. Use the Metafield in the Next Block

Connect the Success node of the REST API block to a Message block or another required block.

Open the Message block and click:

+ Add variable

Select the REST API response and choose the required metafield.

For example, if the response contains:

"response": {   
"gender": "female"
}

the gender field becomes available under the REST API response variables.

The generated variable can then be inserted into the message.

Example:

Customer gender: {{restApi.response.gender}}

The exact REST API block variable name can differ depending on the block, so using the variable picker is recommended instead of manually entering the variable name.


6. Configure the Failure Path

After saving the REST API block, Success and Failure paths are available.

Connect:

Success → Continue the Journey using the fetched metafield.

Failure → Add an appropriate fallback message or alternate Journey flow.

This prevents the customer Journey from getting stuck when the API request fails.


Suppose a Shopify customer has the following metafield:

gender = female

The Journey calls the REST API using:

{   "payload": {     
"id": "{{customer.partnerCustomerId}}",
"type": "customer" }
}

The API returns:

{   "response": {     
"gender": "female"
},
"status": 200,
"success": true
}

You can then select gender from the REST API response variables and use it in the next Message, Condition, Evaluate, or other supported Journey block.


FAQs

1. Which Shopify metafields can be accessed in Journeys?

Metafields associated with the following Shopify objects are supported:

Customer, Product, Order, and Market.

2. How do I fetch Customer Metafields?

Use:

id: {{customer.partnerCustomerId}} type: customer

3. How do I fetch Product Metafields?

Select the relevant Product Id from the Journey variable picker and use:

type: product

4. How do I fetch Order Metafields?

Select the relevant Order Id from the Journey variable picker and use:

type: order

5. How do I fetch Market Metafields?

Use:

type: market

and manually provide the required Shopify Market ID.

6. Can I use the metafield value in another Journey block?

Yes. Add the expected API response under Paste Sample Response. The response fields become available through the variable picker and can be used in subsequent blocks.

7. Do type and id remain the same for every request?

No. Both values depend on the Shopify object whose metafields are being fetched.


For further assistance or to raise feature requests related to Shopify Metafields in Journeys, please contact [email protected].

Did this answer your question?