Transfer Shopify prices to eSagu via n8n: Create the workflow

In Part 1, we connected Shopify and eSagu to n8n and stored the required credentials. In this second part, we create the actual workflow.

The workflow responds to product changes in Shopify, retrieves the Amazon SKU and minimum price from Shopify metafields, and uses them to find the corresponding item in eSagu. n8n then sends the minimum, fixed, and maximum prices to the eSagu API.

Requirements

Before you begin, make sure the following requirements are met:

  • The Shopify and eSagu credentials from Part 1 are stored in n8n.
  • The Shopify item has an Amazon SKU that matches the SKU of the item in eSagu.
  • Shopify contains metafields for the Amazon SKU and Amazon minimum price.
  • A minimum price has been entered for the relevant Shopify product.

1. Create the workflow

  1. In the n8n overview, click Create workflow in the top-right corner.

“Create workflow” button in the n8n overview

  1. Name the workflow, for example, Shopify x eSagu Connector.

  2. Click Add first step.

New n8n workflow named “Shopify x eSagu Connector”

2. Configure the Shopify trigger

  1. Search for Shopify.

  2. Select On product updated from the available triggers.

Selecting the “On product updated” Shopify trigger in n8n

  1. Under Credential to connect with, select the Shopify credentials configured in Part 1.

  2. Keep Product Updated selected under Trigger On.

Configuring the Shopify trigger for updated products

  1. Click Execute step, then update a product in Shopify. n8n waits for the corresponding event.

  2. Verify that n8n successfully receives the product data.

Successful test execution of the Shopify trigger with product data

  1. For clarity, rename the step to Shopify Trigger - On product updated.

Renaming the Shopify trigger

3. Prepare the Shopify metafields

This workflow requires two product metafields:

  • Amazon minimum price
  • Amazon SKU

You can find the metafields in Shopify under SettingsMetafields and metaobjectsProducts.

Shopify settings showing the metafield definitions for products

Metafield for the minimum price

The example uses the following definition:

  • Name: Amazon Minimum Price
  • Namespace and key: custom.amazon_minimum_price
  • Type: Money

Only the key is required for the subsequent n8n configuration:

amazon_minimum_price

Shopify metafield “Amazon Minimum Price” with the “Money” type

Metafield for the Amazon SKU

The example uses the following definition:

  • Name: Amazon SKU
  • Namespace and key: custom.amazon_sku
  • Type: Single line text

The following key is required for the subsequent n8n configuration:

amazon_sku

Shopify metafield “Amazon SKU” with the “Single line text” type

You can use different names and keys. What matters is that the actual keys are entered in the workflow configuration.

4. Add the workflow configuration

  1. Click the plus icon after the Shopify trigger.

  2. Search for Edit Fields (Set) and add the step.

Adding an “Edit Fields (Set)” step

  1. Rename the step to Workflow Configuration.

  2. Use Manual Mapping mode and create the following fields:

Field Type Example value
shopifyShopName String esagu-test-shop
shopifyApiVersion String 2026-07
amazonMinPriceMetafieldKey String amazon_minimum_price
amazonSkuMetafieldKey String amazon_sku
maxPricePercentage Number 0.2
fixedPricePercentage Number 0.1
esaguApiUrl String https://api.esagu.de/amzn/repricing/v1

Configuring the Shopify and eSagu parameters in the n8n workflow

shopifyShopName contains only the part before .myshopify.com. For the shop exampleshop.myshopify.com, enter exampleshop.

The values 0.1 and 0.2 correspond to 10 and 20 percent, respectively. With a minimum price of EUR 13.37, the workflow calculates:

  • Minimum price: EUR 13.37
  • Fixed price: EUR 14.71
  • Maximum price: EUR 16.04

Use an API version supported by Shopify. If you use a different version, adjust shopifyApiVersion accordingly.

5. Retrieve product metafields from Shopify

The product update from the trigger does not contain all required metafields. The next step therefore retrieves the complete metafield data via the Shopify GraphQL Admin API.

  1. Click the plus icon after Workflow Configuration.

  2. Search for HTTP Request and add the step.

Selecting an HTTP Request step

  1. Configure the following settings:
  • Method: POST
  • Authentication: Predefined Credential Type
  • Credential Type: Shopify OAuth2 API
  • Shopify OAuth2 API: the Shopify credentials configured in Part 1
  • Send Body: enabled
  • Body Content Type: JSON
  • Specify Body: Using JSON
  1. Enter the following expression as the URL:
https://{{ $('Workflow Configuration').first().json.shopifyShopName }}.myshopify.com/admin/api/{{ $('Workflow Configuration').first().json.shopifyApiVersion }}/graphql.json
  1. Enter the following GraphQL query in the JSON field:
{
  "query": "query ($id: ID!) { product(id: $id) { id title metafields(first: 25) { nodes { namespace key type value } } } }",
  "variables": {
    "id": "gid://shopify/Product/{{ $('Shopify Trigger - On product updated').item.json.id }}"
  }
}

HTTP request for retrieving the Shopify product metafields

The query retrieves the product ID, title, and up to 25 metafields. If a product has more than 25 relevant metafields, adjust the value in metafields(first: 25) or add pagination.

  1. Click Execute step and verify that Shopify returns the product and metafield data.

Successful GraphQL query of the Shopify metafields

  1. Rename the step to HTTP Request - Shopify Metadata.

Renaming the HTTP request for Shopify metadata

6. Prepare the SKU and price values

The eSagu API processes price values in cents. A Shopify minimum price of EUR 13.37 is therefore transmitted as 1337.

  1. Add another Edit Fields (Set) step after HTTP Request - Shopify Metadata.

Adding an Edit Fields step to prepare the metafields

  1. Name the step Edit Fields - Extract meta objects by name.

  2. Select Manual Mapping mode.

  3. Create the following fields.

Shopify Product ID

  • Field name: Shopify Product ID
  • Type: String
  • Value:
{{ $json.data.product.id }}

SKU / ID

  • Field name: SKU / ID
  • Type: String
  • Value:
{{ $json.data.product.metafields.nodes.find(m => m.key === $('Workflow Configuration').first().json.amazonSkuMetafieldKey)?.value ?? null }}

Min price

  • Field name: Min price
  • Type: Number
  • Value:
{{ (() => {
  const config = $('Workflow Configuration').first().json;
  const key = config.amazonMinPriceMetafieldKey;
  const metafield = $json.data.product.metafields.nodes.find(m => m.key === key);
  const amount = metafield
    ? JSON.parse(metafield.value)?.amount * 100
    : null;

  return Math.round(amount);
})() }}

Fixed price

  • Field name: Fixed price
  • Type: Number
  • Value:
{{ (() => {
  const config = $('Workflow Configuration').first().json;
  const key = config.amazonMinPriceMetafieldKey;
  const fixedPricePercentage = config.fixedPricePercentage;
  const metafield = $json.data.product.metafields.nodes.find(m => m.key === key);
  const amount = metafield
    ? JSON.parse(metafield.value)?.amount * 100
    : null;

  return Math.round(amount + (amount * fixedPricePercentage));
})() }}

Max price

  • Field name: Max price
  • Type: Number
  • Value:
{{ (() => {
  const config = $('Workflow Configuration').first().json;
  const key = config.amazonMinPriceMetafieldKey;
  const maxPriceMarkupPercentage = config.maxPricePercentage;
  const metafield = $json.data.product.metafields.nodes.find(m => m.key === key);
  const amount = metafield
    ? JSON.parse(metafield.value)?.amount * 100
    : null;

  return Math.round(amount + (amount * maxPriceMarkupPercentage));
})() }}

Extracting the Amazon SKU and calculating the three price values

  1. Execute the step. The output should contain the Shopify product ID, the SKU, and the three prices.

The example shown produces:

{
  "Shopify Product ID": "gid://shopify/Product/15955548275022",
  "SKU / ID": "01-0164",
  "Min price": 1337,
  "Fixed price": 1471,
  "Max price": 1604
}

7. Find the item in eSagu by SKU

  1. Add an HTTP Request after the previous step.

Selecting an HTTP request for the item search in eSagu

  1. Name the step HTTP Request - Find item in eSagu via SKU.

  2. Configure the following settings:

  • Method: GET
  • URL:
{{ $('Workflow Configuration').first().json.esaguApiUrl }}/item
  • Authentication: Generic Credential Type
  • Generic Auth Type: Bearer Auth
  • Bearer Auth: the eSagu credentials configured in Part 1
  1. Enable Send Query Parameters and enter the following parameters:
Name Value
by-sku-exact true
by-sku {{ $json['SKU / ID'] }}

Configuring an exact eSagu item search using the Amazon SKU

  1. Execute the step. The response must contain exactly the eSagu item whose SKU matches the Shopify metafield.

Item successfully found by SKU in the eSagu API

8. Validate the API response

Before changing any prices, the workflow checks whether the request was successful and returned exactly one item.

  1. Add an If step after the eSagu item search.

Adding an If step to validate the eSagu response

  1. Name the step If - Check for eSagu API errors.

  2. Combine two conditions using AND:

First condition:

  • Value 1: {{ $json.statusCode }}
  • Operator: is less than
  • Value 2: 399

Second condition:

  • Value 1: {{ $json.body.length }}
  • Operator: is equal to
  • Value 2: 1

If conditions for the HTTP status and number of items found

Only the true output is connected to the subsequent steps. The workflow therefore makes no changes if the API returns an error or the SKU cannot be mapped unambiguously.

9. Simplify the eSagu response

  1. Add another Edit Fields (Set) step to the true output of the If step.

Adding an Edit Fields step to the true output

  1. Name the step Edit Fields - Simplify response.

  2. Create a field with the following settings:

  • Field name: body
  • Type: Object
  • Value:
{{ $json.body.find(() => true) }}
  1. Keep Include Other Input Fields disabled.

  2. Execute the step and verify that body now directly contains the item object that was found.

Simplified eSagu response containing the item object that was found

10. Transfer the price limits to eSagu

  1. Add another HTTP Request after Edit Fields - Simplify response.

Adding the HTTP request for updating prices

  1. Name the step HTTP Request - Edit item.

  2. Configure the following settings:

  • Method: PUT
  • URL:
{{ $('Workflow Configuration').first().json.esaguApiUrl }}/item/{{ $json.body.id }}/strategy
  • Authentication: Generic Credential Type
  • Generic Auth Type: Bearer Auth
  • Bearer Auth: the eSagu credentials configured in Part 1
  1. Enable Send Headers and enter the following header:
Name Value
accept application/json

Configuring the PUT request to the eSagu strategy endpoint

  1. Enable Send Body.

  2. Select the following settings:

  • Body Content Type: JSON
  • Specify Body: Using JSON
  1. Enter the following JSON body:
{
  "priceSettings": {
    "minPrice": {{ $('Edit Fields - Extract meta objects by name').item.json['Min price'] }},
    "fixedPrice": {{ $('Edit Fields - Extract meta objects by name').item.json['Fixed price'] }},
    "maxPrice": {{ $('Edit Fields - Extract meta objects by name').item.json['Max price'] }},
    "mode": "{{ $('HTTP Request - Find item in eSagu via SKU')?.item?.json?.strategy?.priceSettings?.mode || 'OPTIMIZATION' }}"
  }
}
  1. Under OptionsResponse, enable Include Response Headers and Status.

  2. Click Execute step.

JSON body and successful status response from the eSagu API

The HTTP status 204 No Content confirms that eSagu successfully applied the price limits.

11. Test and activate the workflow

The completed workflow consists of the following steps:

  1. Shopify Trigger - On product updated
  2. Workflow Configuration
  3. HTTP Request - Shopify Metadata
  4. Edit Fields - Extract meta objects by name
  5. HTTP Request - Find item in eSagu via SKU
  6. If - Check for eSagu API errors
  7. Edit Fields - Simplify response
  8. HTTP Request - Edit item

Complete n8n workflow for transferring Shopify prices to eSagu

First, run a complete test with a single product. Then verify in eSagu that the minimum, fixed, and maximum prices were applied correctly.

If the test was successful:

  1. Save the workflow.
  2. Switch the toggle in the top-right corner from Inactive to Active.

From this point on, n8n responds to product changes in Shopify. Whenever a product is updated, the workflow retrieves its Amazon SKU and minimum price and updates the corresponding price limits in eSagu.

Use the workflow as a template for further automations

The workflow shown is not limited to Shopify or Amazon RePricing. It serves as a template for connecting any third-party system to eSagu:

  1. Retrieve data from a source system
  2. Prepare the required values
  3. Find the corresponding record in eSagu
  4. Transfer the data via the eSagu API
  5. Validate the response and handle errors

Instead of Shopify, the data source can be an inventory management system, an ERP or PIM system, a database, a CSV file, a webhook, or another API. In n8n, only the trigger and the steps for retrieving and preparing the data need to be adjusted.

The same principle can also be used with other eSagu APIs, including:

  • RePricing for Amazon
  • RePricing for eBay
  • RePricing for Kaufland
  • RePricing for OTTO
  • Lost & Found
  • HelpDesk

This makes it possible to transfer more than just price limits. Depending on the API used, you can, for example, search for and edit items, synchronize settings, retrieve cases, or automate HelpDesk processes.

The available endpoints, fields, and methods differ depending on the eSagu product. For additional workflows, consult the documentation for the relevant eSagu API and adjust the URL, HTTP method, parameters, and JSON content accordingly.