How can we add products in the cart according to the website?

I have multiple websites in a single Magento installation. When I am adding a product by GraphQl then it's adding the product on the base website. Not in the targeted website.

Even my all website URL is different and Graphql endpoint also using according to the website. But it's adding in base website

For example, My endpoint is below


But it's adding the product in below website


Where I need to pass website id in below mutation. I have created token and cart id from this URL www.example-website2.com/graphql

mutation {
    input: {
      cart_id: "{ CART_ID }"
      cart_items: [
          data: {
            quantity: 1
            sku: "simple-product"
  ) {
    cart {
      items {
        product {

1 Answer 1


The official documentation says Magento accepts the following headers in a GraphQL request: Store code is one among them, so you can pass store code as a header parameter.

  • Authorization
  • Content-Currency
  • Content-Type
  • Preview-Version
  • Store


Never tested though, but this will guide you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.