Skip to content

Instantly share code, notes, and snippets.

@jbtwo
jbtwo / companyLocationAssignStaffMembers.graphql
Created July 22, 2025 22:10
Assign Shopify staff member (sales rep) to company location
mutation {
companyLocationAssignStaffMembers(
companyLocationId: "gid://shopify/CompanyLocation/24590188773"
staffMemberIds: ["gid://shopify/StaffMember/94618681573"]
) {
companyLocationStaffMemberAssignments {
id
}
userErrors {
field
@jbtwo
jbtwo / getCatalogPrices.graphql
Created July 16, 2025 15:47
Shopify GraphQL query to retrieve catalog prices by providing catalog_id and variant_ids
query GetCatalogPrices(
$priceListId: ID!,
$variantSearch: String!
) {
priceList(id: $priceListId) {
id
name
currency
prices(first: 100, query: $variantSearch) {
nodes {
@jbtwo
jbtwo / getOrders.graphql
Last active July 16, 2025 15:47
Shopify order query with b2b company and catalog data
query getOrder {
orders(first: 100) {
edges {
node {
id
name
email
purchasingEntity {
... on PurchasingCompany {
company {
@jbtwo
jbtwo / order_query.graphql
Created July 2, 2025 20:15
Shopify GraphQL Order Query incl. Company Metafields
{
orders(first: 100) {
edges {
node {
id
name
email
purchasingEntity {
... on PurchasingCompany {
company {
mutation {
bulkOperationRunQuery(
query: """
{
orders {
edges {
node {
id
name
cancelledAt
@jbtwo
jbtwo / bulk_order_export_all_fields.graphql
Last active September 14, 2023 13:32
Bulk export orders
mutation {
bulkOperationRunQuery(
query: """
{
orders {
edges {
node {
id
name
billingAddress {
@jbtwo
jbtwo / bulkPoll.graphql
Last active August 11, 2023 12:47
Bulk Poll
{
currentBulkOperation {
id
status
errorCode
createdAt
completedAt
objectCount
fileSize
url
@jbtwo
jbtwo / bulk_customer_export_all_fields.graphql
Last active September 14, 2023 13:39
Bulk customer export
mutation {
bulkOperationRunQuery(
query: """
{
customers {
edges {
node {
firstName
lastName
@jbtwo
jbtwo / shared-cart.js
Created February 28, 2023 14:47
Shared cart across subdomains
function getCookie(cname) {
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(";");
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == " ") {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
@jbtwo
jbtwo / bulkOp.graphql
Created August 19, 2021 16:47
Bulk Order Query
mutation {
bulkOperationRunQuery(
query:"""
{
orders(query: "created_at:>'2021-08-01T00:00:00-04:00'") {
edges {
node {
id
name
createdAt