Documentation Index
Fetch the complete documentation index at: https://docs.heychocolate.com/llms.txt
Use this file to discover all available pages before exploring further.
type ShoppingCart {
id: ID!
sessionId: String!
items: [CartItem!]!
totalCo2Equivalent: Float!
totalMkiScore: Float
shippingImpact: Float
equivalency: Equivalency
perItemBreakdown: [CartItemImpact!]!
updatedAt: DateTime!
}
type CartItem {
productId: ID!
product: Product!
quantity: Int!
}
type CartItemImpact {
productId: ID!
productName: String!
quantity: Int!
co2Equivalent: Float!
percentage: Float!
}
input CartInput {
sessionId: String!
items: [CartItemInput!]!
shippingMethod: TransportMethod
shippingAddress: AddressInput
}
input CartItemInput {
productId: ID!
quantity: Int!
}
input AddressInput {
country: String!
postalCode: String
}
Fields
| Field | Type | Description |
|---|
id | ID! | Cart identifier |
sessionId | String! | E-commerce session ID |
items | [CartItem!]! | Items in the cart |
totalCo2Equivalent | Float! | Total cart carbon footprint |
totalMkiScore | Float | Total MKI score |
shippingImpact | Float | Shipping-related emissions |
equivalency | Equivalency | Human-readable total impact |
perItemBreakdown | [CartItemImpact!]! | Impact per line item |
Example mutation
mutation {
calculateCartImpact(input: {
sessionId: "session_abc"
items: [
{ productId: "prod_abc123", quantity: 2 },
{ productId: "prod_def456", quantity: 1 }
]
shippingMethod: STANDARD
shippingAddress: { country: "NL", postalCode: "1012AB" }
}) {
totalCo2Equivalent
totalMkiScore
shippingImpact
perItemBreakdown {
productName
quantity
co2Equivalent
percentage
}
equivalency {
description
value
}
}
}
Shopify integration
For Shopify stores, use the session ID from the Shopify cart token:
mutation {
calculateCartImpact(input: {
sessionId: "shopify_cart_abc123"
items: [
{ productId: "shopify_variant_123", quantity: 1 }
]
shippingMethod: STANDARD
shippingAddress: { country: "NL" }
}) {
totalCo2Equivalent
equivalency { description value }
}
}
See the Shopify SDK for a drop-in integration.