shop
shop lets agents search millions of stores, build carts, check out and pay with the shopper's Shop account, and track orders. When a store has no agent checkout, the shopper can approve a purchase on Shop and the agent gets a one-time credential to pay at the site's own checkout.
Contents
Install
npm install --global @shopify/shop@latest
shop skill --install
Installs the shop command, then teaches your agent when and how to use it. Then ask your agent:
Find three rain jackets under US$100 that ship to the US.
A full purchase, from search to tracking, takes five commands:
shop search "trail running shoes" --ships-to US --limit 3
shop cart create --shop example-store.com --variant gid://shopify/ProductVariant/1001 --quantity 1
shop checkout create --shop example-store.com --cart gid://shopify/Cart/…
shop checkout complete gid://shopify/Checkout/… --shop example-store.com --instrument '…'
shop order search "trail running shoes"
Search for products
shop search "trail running shoes" --ships-to US --currency USD --limit 3
Example output
{
"ok": true, "v": 1,
"data": {
"products": [
{
"id": "gid://shopify/p/7Qk2mN9pR4sT6vW8xY0zA1",
"title": "Ridgeline Trail Runner",
"description": { "plain": "Lightweight trail running shoes with a grippy outsole…" },
"variants": [{
"id": "gid://shopify/ProductVariant/1001",
"price": { "amount": 14500, "currency": "USD" },
"availability": { "available": true },
"options": [{ "name": "Size", "label": "10" }, { "name": "Color", "label": "Slate" }],
"rating": { "value": 4.7, "scale_max": 5, "count": 212 },
"seller": { "name": "Example Store", "url": "https://example-store.com", "domain": "example-store.myshopify.com" },
"checkout_url": "https://example-store.com/cart/1001:1?…&payment=shop_pay"
}]
},
// …two more products
],
"pagination": { "has_next_page": true, "total_count": 1180 },
"next": [
"A featured variant may already answer the user's needs; use get_product only for other options or a concrete missing fact…",
// …
]
}
}
Prices are integers in the currency's minor units, so 14500 is US$145.00.
Beyond a text query, a search can be shaped three ways:
- Filters such as
--ships-to, --price-max and --size are hard constraints.
--intent describes what the shopper needs and steers the ranking.
--like-image and --like-id find products similar to an image or to another product.
shop search --like-image ./jacket.jpg --ships-to US
shop search --like-id gid://shopify/p/7Qk2mN9pR4sT6vW8xY0zA1 --limit 3
shop search "trail shoes" --intent "wide feet, wet Pacific Northwest trails" --currency USD --price-max 20000 --size 11
A variant may also include checkout_url, a buy-now link to the merchant's checkout. A shopper signed in to Shop sees a one-tap review screen there. They can approve the purchase as it is, or change the delivery option, payment method, discounts, and more first.
Sign in for personalization and accelerated checkout
Sign-in is optional: search, carts, and checkouts work without it. Signing in to Shop adds:
- Search results ranked using the shopper's own history.
- Carts and checkouts that arrive with the shopper's saved address and payment preference filled in.
- The account, checkout completion, order, and spend-request commands in the sections below.
shop account login --device-name "My Awesome Agent"
Example output
{
"ok": true, "v": 1,
"data": {
"signed_in": false,
"pending": {
"verification_uri": "https://accounts.shop.app/device",
"verification_uri_complete": "https://accounts.shop.app/device?user_code=…",
"user_code": "…",
"expires_at": "…",
"interval": 5
}
}
}
Signing in takes two runs of the same command:
- With
--wait 0, it returns a link and code right away. The agent shows them to the shopper.
- With
--wait 90, it waits up to 90 seconds for the shopper to approve on Shop and returns signed_in: true as soon as they do. If they haven't approved yet, it returns signed_in: false and the agent can run it again.