Skip to content

Instantly share code, notes, and snippets.

@darryn
Last active February 26, 2024 01:41
Show Gist options
  • Save darryn/313d3b88f07bbe4cf4c64a9dc689a4ea to your computer and use it in GitHub Desktop.
Save darryn/313d3b88f07bbe4cf4c64a9dc689a4ea to your computer and use it in GitHub Desktop.
B2B APIs
mutation priceListCreate($input: PriceListCreateInput!) {
priceListCreate(input: $input) {
priceList {
id
}
userErrors {
field
message
}
}
}
{
"input": {
"name": "Negotiated Prices for [Company]",
"currency": "NZD",
"parent": {
"adjustment": {
"type": "PERCENTAGE_DECREASE",
"value": 0
},
"settings": {
"compareAtMode": "NULLIFY"
}
}
}
}
mutation priceListFixedPricesAdd($priceListId: ID!, $prices: [PriceListPriceInput!]!) {
priceListFixedPricesAdd(priceListId: $priceListId, prices: $prices) {
prices {
compareAtPrice {
amount
currencyCode
}
price {
amount
currencyCode
}
}
userErrors {
field
code
message
}
}
}
{
"priceListId": "gid://shopify/PriceList/[PRICELISTID]",
"prices": [
{
"compareAtPrice": {
"amount": "8",
"currencyCode": "NZD"
},
"price": {
"amount": "5",
"currencyCode": "NZD"
},
"variantId": "gid://shopify/ProductVariant/46559470354488" //Clover Honey
},
{
"compareAtPrice": {
"amount": "10",
"currencyCode": "NZD"
},
"price": {
"amount": "5",
"currencyCode": "NZD"
},
"variantId": "gid://shopify/ProductVariant/42563260678200" //Manuka Honey
}
]
}
mutation publicationCreate {
publicationCreate(input: {
autoPublish: false
defaultState: EMPTY
}) {
publication {
id
}
userErrors {
code
field
message
}
}
}
mutation publicationUpdate {
publicationUpdate(
id: "gid://shopify/Publication/[PUBLICATION_ID]",
input: {
publishablesToAdd: ["gid://shopify/Product/7605448507448", "gid://shopify/Product/8670490918968"]
}) {
publication {
products(first: 10) {
edges {
node {
id
}
}
}
}
userErrors {
field
code
message
}
}
}
mutation catalogCreate($input: CatalogCreateInput!) {
catalogCreate(input: $input) {
catalog {
title
status
priceList { id }
publication { id }
}
userErrors {
field
code
message
}
}
}
{
"input": {
"title": "Negotiated Catalog for [Company]",
"status": "ACTIVE",
"context": {
"companyLocationIds": [
"gid://shopify/CompanyLocation/[Location ID]"
]
},
"priceListId": "gid://shopify/PriceList/[PRICELIST_ID]",
"publicationId": "gid://shopify/Publication/[PUBLICATION_ID]"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment