Anchor to section titled 'undefined'

priceListFixedPricesAdd
mutation

Requires write_products access scope. Also: The shop has the international_price_overrides or Markets or B2B features enabled.

Creates or updates fixed prices on a price list. You can use the priceListFixedPricesAdd mutation to set a fixed price for specific product variants. This lets you change product variant pricing on a per country basis. Any existing fixed price list prices for these variants will be overwritten.


Anchor to priceListId
priceListId
required

The ID of the price list to which the fixed prices will be added or updated.

The list of fixed prices to add or update in the price list.


Was this section helpful?

The list of fixed prices that were added to or updated in the price list.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation priceListFixedPricesAdd($priceListId: ID!, $prices: [PriceListPriceInput!]!) {
  priceListFixedPricesAdd(priceListId: $priceListId, prices: $prices) {
    prices {
      compareAtPrice {
        amount
        currencyCode
      }
      price {
        amount
        currencyCode
      }
    }
    userErrors {
      field
      code
      message
    }
  }
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation priceListFixedPricesAdd($priceListId: ID!, $prices: [PriceListPriceInput!]!) { priceListFixedPricesAdd(priceListId: $priceListId, prices: $prices) { prices { compareAtPrice { amount currencyCode } price { amount currencyCode } } userErrors { field code message } } }",
 "variables": {
    "priceListId": "gid://shopify/PriceList/115567603",
    "prices": [
      {
        "compareAtPrice": {
          "amount": "125.50",
          "currencyCode": "CAD"
        },
        "price": {
          "amount": "100",
          "currencyCode": "CAD"
        },
        "variantId": "gid://shopify/ProductVariant/43729076"
      },
      {
        "compareAtPrice": {
          "amount": "6.99",
          "currencyCode": "CAD"
        },
        "price": {
          "amount": "4",
          "currencyCode": "CAD"
        },
        "variantId": "gid://shopify/ProductVariant/138327650"
      }
    ]
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation priceListFixedPricesAdd($priceListId: ID!, $prices: [PriceListPriceInput!]!) {
    priceListFixedPricesAdd(priceListId: $priceListId, prices: $prices) {
      prices {
        compareAtPrice {
          amount
          currencyCode
        }
        price {
          amount
          currencyCode
        }
      }
      userErrors {
        field
        code
        message
      }
    }
  }`,
  {
    variables: {
      "priceListId": "gid://shopify/PriceList/115567603",
      "prices": [
        {
          "compareAtPrice": {
            "amount": "125.50",
            "currencyCode": "CAD"
          },
          "price": {
            "amount": "100",
            "currencyCode": "CAD"
          },
          "variantId": "gid://shopify/ProductVariant/43729076"
        },
        {
          "compareAtPrice": {
            "amount": "6.99",
            "currencyCode": "CAD"
          },
          "price": {
            "amount": "4",
            "currencyCode": "CAD"
          },
          "variantId": "gid://shopify/ProductVariant/138327650"
        }
      ]
    },
  },
);

const data = await response.json();
session = ShopifyAPI::Auth::Session.new(
  shop: "your-development-store.myshopify.com",
  access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
  session: session
)

query = <<~QUERY
  mutation priceListFixedPricesAdd($priceListId: ID!, $prices: [PriceListPriceInput!]!) {
    priceListFixedPricesAdd(priceListId: $priceListId, prices: $prices) {
      prices {
        compareAtPrice {
          amount
          currencyCode
        }
        price {
          amount
          currencyCode
        }
      }
      userErrors {
        field
        code
        message
      }
    }
  }
QUERY

variables = {
  "priceListId": "gid://shopify/PriceList/115567603",
  "prices": [{"compareAtPrice"=>{"amount"=>"125.50", "currencyCode"=>"CAD"}, "price"=>{"amount"=>"100", "currencyCode"=>"CAD"}, "variantId"=>"gid://shopify/ProductVariant/43729076"}, {"compareAtPrice"=>{"amount"=>"6.99", "currencyCode"=>"CAD"}, "price"=>{"amount"=>"4", "currencyCode"=>"CAD"}, "variantId"=>"gid://shopify/ProductVariant/138327650"}]
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation priceListFixedPricesAdd($priceListId: ID!, $prices: [PriceListPriceInput!]!) {
      priceListFixedPricesAdd(priceListId: $priceListId, prices: $prices) {
        prices {
          compareAtPrice {
            amount
            currencyCode
          }
          price {
            amount
            currencyCode
          }
        }
        userErrors {
          field
          code
          message
        }
      }
    }`,
    "variables": {
      "priceListId": "gid://shopify/PriceList/115567603",
      "prices": [
        {
          "compareAtPrice": {
            "amount": "125.50",
            "currencyCode": "CAD"
          },
          "price": {
            "amount": "100",
            "currencyCode": "CAD"
          },
          "variantId": "gid://shopify/ProductVariant/43729076"
        },
        {
          "compareAtPrice": {
            "amount": "6.99",
            "currencyCode": "CAD"
          },
          "price": {
            "amount": "4",
            "currencyCode": "CAD"
          },
          "variantId": "gid://shopify/ProductVariant/138327650"
        }
      ]
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation priceListFixedPricesAdd($priceListId: ID!, $prices: [PriceListPriceInput!]!) {
    priceListFixedPricesAdd(priceListId: $priceListId, prices: $prices) {
      prices {
        compareAtPrice {
          amount
          currencyCode
        }
        price {
          amount
          currencyCode
        }
      }
      userErrors {
        field
        code
        message
      }
    }
  }
QUERY;

$variables = [
  "priceListId" => "gid://shopify/PriceList/115567603",
  "prices" => [{"compareAtPrice"=>{"amount"=>"125.50", "currencyCode"=>"CAD"}, "price"=>{"amount"=>"100", "currencyCode"=>"CAD"}, "variantId"=>"gid://shopify/ProductVariant/43729076"}, {"compareAtPrice"=>{"amount"=>"6.99", "currencyCode"=>"CAD"}, "price"=>{"amount"=>"4", "currencyCode"=>"CAD"}, "variantId"=>"gid://shopify/ProductVariant/138327650"}],
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "priceListId": "gid://shopify/PriceList/115567603",
  "prices": [
    {
      "compareAtPrice": {
        "amount": "125.50",
        "currencyCode": "CAD"
      },
      "price": {
        "amount": "100",
        "currencyCode": "CAD"
      },
      "variantId": "gid://shopify/ProductVariant/43729076"
    },
    {
      "compareAtPrice": {
        "amount": "6.99",
        "currencyCode": "CAD"
      },
      "price": {
        "amount": "4",
        "currencyCode": "CAD"
      },
      "variantId": "gid://shopify/ProductVariant/138327650"
    }
  ]
}
Hide code
Response
JSON
{
  "priceListFixedPricesAdd": {
    "prices": [
      {
        "compareAtPrice": {
          "amount": "125.5",
          "currencyCode": "CAD"
        },
        "price": {
          "amount": "100.0",
          "currencyCode": "CAD"
        }
      },
      {
        "compareAtPrice": {
          "amount": "6.99",
          "currencyCode": "CAD"
        },
        "price": {
          "amount": "4.0",
          "currencyCode": "CAD"
        }
      }
    ],
    "userErrors": []
  }
}