Credit limit for B2B store

Credit limit for B2B store

Khasim1
Shopify Partner
30 0 0

Hi 

 

Is it possible to set up credit limit on the B2B store using any apps, if yes can you share the documentation for implementing the same?

 

Thanks,

Khasim

Reply 1 (1)

Khasim1
Shopify Partner
30 0 0

Im developing this using graphql 

---------------run.graphql file-------------

query {
  company(id: "gid://shopify/Company/abc") {
    metafield(namespace: "b2b", key: "credit_limit_remaining") {
      value
    }
  }
}
And changes "Input" to "Company" in
----------schema.graphql------------------
schema {
  query: Company
  mutation: MutationRoot
}
Trying to access the value in run.js 
    const credit_limit = Number(input.company.metafield?.value);
But errorCommand failed with exit code 1: npm exec -- graphql-code-generator --config package.json
[FAILED] GraphQL Document Validation failed with 1 errors;
[FAILED] Error 0: Cannot query field "company" on type "Company".
[FAILED] at C:/Users/Khasim/shopify-functions/lucrative-consumer-app/extensions/cart-checkout-validatio
n/src/run.graphql:2:3
 
Any idea how to resolve this error?
 
Thanks
Khasim