Create a catalog item with variations
Item creation options
Created catalog object
Create a pricing rule that applies a discount to a product set, optionally restricted to members of given customer groups.
Create a product set — a named collection of catalog objects used as the match target of a pricing rule.
Create a time period (RFC 5545 iCalendar VEVENT) for use in time-bounded pricing rules, e.g. happy-hour discounts.
Create a complete wholesale pricing configuration in a single atomic batch upsert: a product set, a discount, and a pricing rule that links them to the given customer group.
The three objects are created together with temporary IDs so the pricing
rule can reference the just-created product set and discount. The customer
group must already exist — create it via square.customerGroups.create.
Find item variations by UPC (barcode) or SKU, without listing the whole catalog. Pages through every match, and returns the parent items too.
Codes are matched exactly, not normalized: a UPC-A 012345678905 won't
find the same barcode stored as EAN-13 0012345678905. Pass both forms if
the catalog may hold either.
UPCs and/or SKUs to match (exact, case insensitive)
The matching variations and their parent items
Search the catalog
Optionaloptions: SearchCatalogOptions
Search options
Matching catalog objects with pagination
Upsert (create or update) a catalog object
The catalog object to upsert
OptionalidempotencyKey: string
Optional idempotency key
The upserted catalog object
// Update an existing item's custom attributes
const updatedItem = await square.catalog.upsert({
type: 'ITEM',
id: 'EXISTING_ITEM_ID',
version: existingItem.version,
customAttributeValues: {
'Square:some-key': { stringValue: 'new value' }
},
itemData: existingItem.itemData,
});
// Update a variation price
const updatedVariation = await square.catalog.upsert({
type: 'ITEM_VARIATION',
id: 'EXISTING_VARIATION_ID',
version: existingVariation.version,
itemVariationData: {
...existingVariation.itemVariationData,
priceMoney: { amount: BigInt(500), currency: 'USD' },
},
});
Catalog service for managing Square catalog items
Example