---
title: Next.js Shopify Storefront API Upgrade Guide
slug: oms/2oin-nextjs-shopify-storefront-api-upgrade-guide
docTags: 
createdAt: 2022-12-21T21:46:37.000Z
---

Chord released package updates with support for the Shopify Storefront API version `2022-07`. Prior to this release, these packages used the oldest available version of the Storefront API.

Upgrading these packages is strongly advised because two breaking changes will impact users around January 1, 2023, when Shopify starts serving the version `2022-04` to users.&#x20;

## New Releases

`@chordcommerce/chord-js-performance@2.0.0`&#x20;
`@chordcommerce/product-rss-feed@3.0.0`&#x20;
`@chordcommerce/chord-js-auth-shopify@2.0.0`&#x20;

## Major Changes

These releases upgrade 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 releases.

## Upgrade Guide

### 1. Update dependencies

1. Update `@chordcommerce/chord-js-performance` and `@chordcommerce/chord-js-auth-shopify` to `^2.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](https://shopify.dev/changelog/changes-to-storefront-api-object-ids). You may have code in your website that is encoding and/or decoding IDs. This code can be removed.

Previous versions of `nextjs-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`&#x20;

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{type="warning"}
If you are querying the Storefront API without using&#x20;

`@chordcommerce/chord-js-performance`

, be sure to check for breaking changes in&#x20;

&#x20;before upgrading the Storefront API version.
:::

## Example Migration

See [an example](https://github.com/chordcommerce/nextjs-starter-performance/commit/28dd4278aada3d63f62d3ce7c035a016cd354dbc) of migrating a Next.js site by checking out how Chord [migrated the Next.js starter kit](https://github.com/chordcommerce/nextjs-starter-performance/commit/28dd4278aada3d63f62d3ce7c035a016cd354dbc).

