0

UpdateItemModifierLists

by
Published Oct 17, 2025

Updates the [CatalogModifierList]($m/CatalogModifierList) objects that apply to the targeted [CatalogItem]($m/CatalogItem) without having to perform an upsert on the entire item.

Script square Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Square = {
3
  token: string;
4
};
5
/**
6
 * UpdateItemModifierLists
7
 * Updates the [CatalogModifierList]($m/CatalogModifierList) objects
8
that apply to the targeted [CatalogItem]($m/CatalogItem) without having
9
to perform an upsert on the entire item.
10
 */
11
export async function main(
12
  auth: Square,
13
  body: {
14
    item_ids: string[];
15
    modifier_lists_to_enable?: string[];
16
    modifier_lists_to_disable?: string[];
17
  },
18
) {
19
  const url = new URL(
20
    `https://connect.squareup.com/v2/catalog/update-item-modifier-lists`,
21
  );
22

23
  const response = await fetch(url, {
24
    method: "POST",
25
    headers: {
26
      "Content-Type": "application/json",
27
      Authorization: "Bearer " + auth.token,
28
    },
29
    body: JSON.stringify(body),
30
  });
31
  if (!response.ok) {
32
    const text = await response.text();
33
    throw new Error(`${response.status} ${text}`);
34
  }
35
  return await response.json();
36
}
37