> For the complete documentation index, see [llms.txt](https://docs.chord.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chord.co/chord-oms/shopify/developer-tools/gatsby/guides/v3-x-to-v4-x-migration-guide.md).

# v3.x to v4.x Migration Guide

This major release upgrades the Shopify Storefront API version to `2022-07`. Prior to this release, this theme used the oldest available version of the Storefront API.

Upgrading to this release is strongly advised because two breaking changes will impact users around January 1, 2023, when Shopify starts serving the version `2022-04` to users.

## Major Changes

This release upgrades the Shopify Storefront API version to `2022-07`. This Storefront API version includes two breaking changes:

* Shopify IDs are [no longer Base64 encoded](https://shopify.dev/changelog/changes-to-storefront-api-object-ids).
* `presentmentPrices` has been removed from the API and will cause an error if included in the GraphQL query. Shopify now [supports multi-currency in a different way](https://shopify.dev/custom-storefronts/internationalization/international-pricing).

These are the only changes in this release.

## Upgrade Guide

### 1. Update dependencies

1. Update `@chordcommerce/gatsby-theme-performance` to `^4.0.0`
2. If you have `@chordcommerce/product-rss-feed` as a dependency, update to `^3.0.0`

### 2. Remove Shopify ID encoding/decoding logic

As of the 2022-04 Shopify Storefront API release, Shopify IDs are no longer Base64 encoded. You may have code in your website that is encoding and/or decoding IDs. This code can be removed.

Previous versions of `gatsby-starter-performance` included a utility file at `src/utils/shopify/index.js` with two functions, `encodeShopifyVariantID` and `decodeShopifyID`. If you're using these functions in your website code, update the code as described below.

Replace this code:

```javascript
export const encodeShopifyVariantID = (id) =>
  Buffer.from(`gid://shopify/ProductVariant/${id}`).toString('base64')

export const decodeShopifyID = (base64Id) => {
  const shopifyId = Buffer.from(base64Id, 'base64').toString('utf-8')
  const [id] = shopifyId.split('/').reverse()
  return id
}
```

With this code:

```javascript
export const encodeShopifyVariantID = (id) =>
  `gid://shopify/ProductVariant/${id}`

export const decodeShopifyID = (shopifyId) => {
  const [id] = shopifyId.split('/').reverse()
  return id
}
```

### 3. Remove any use of the field `presentmentPrices`

Shopify no longer supports the deprecated field `presentmentPrices`.

### 4. Update any references to the Shopify Storefront API version

You may have references to the Shopify Storefront API version in your website code. You must update your code to use at least Storefront API version `2022-04`, because that will be the oldest version that Shopify supports as of January 1, 2023.

\We suggest updating all Storefront API versions to `2022-07` for consistency. Searching your code for the Shopify Storefront API, `myshopify.com/api`, might be helpful. To update the version, just change the version in the Storefront API path. For example, this:

```javascript
const path = `https://${SHOPIFY_SUBDOMAIN}.myshopify.com/api/2021-01/graphql.json`
```

Should be replaced with this:

```javascript
const path = `https://${SHOPIFY_SUBDOMAIN}.myshopify.com/api/2022-07/graphql.json`
```

{% hint style="warning" %}
If you are querying the Storefront API without using

`@chordcommerce/gatsby-theme-performance`

, be sure to check for breaking changes in

before upgrading the Storefront API version.
{% endhint %}

## Example Migration

See [an example](https://github.com/chordcommerce/gatsby-starter-performance/commit/18c6c575af4786d61cf43f2bc32997358dad3977) of migrating a Gatsby site by checking out how Chord [migrated the Gatsby starter kit](https://github.com/chordcommerce/gatsby-starter-performance/commit/18c6c575af4786d61cf43f2bc32997358dad3977).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chord.co/chord-oms/shopify/developer-tools/gatsby/guides/v3-x-to-v4-x-migration-guide.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
