scandipwa / quote-graphql
N/A
3.1.0
2024-07-14 20:32 UTC
Requires
- magento/framework: *
- magento/module-authorization: *
- magento/module-bundle: *
- magento/module-bundle-graph-ql: ^100.3
- magento/module-catalog-rule: *
- magento/module-checkout: *
- magento/module-customer: *
- magento/module-integration: *
- magento/module-inventory-configuration-api: *
- magento/module-inventory-reservations-api: *
- magento/module-inventory-sales-api: *
- magento/module-quote: *
- magento/module-quote-graph-ql: ^100.3
- magento/module-sales: *
- magento/module-webapi: *
- scandipwa/performance: ^1.0
- dev-master
- 3.1.0
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.19.26
- 2.19.25
- 2.19.24
- 2.19.23
- 2.19.22
- 2.19.21
- 2.19.20
- 2.19.19
- 2.19.18
- 2.19.17
- 2.19.16
- 2.19.15
- 2.19.14
- 2.19.13
- 2.19.12
- 2.19.11
- 2.19.10
- 2.19.9
- 2.19.8
- 2.19.7
- 2.19.6
- 2.19.5
- 2.19.4
- 2.19.3
- 2.19.2
- 2.19.1
- 2.19.0
- 2.18.2
- 2.18.1
- 2.18.0
- 2.17.9
- 2.17.8
- 2.17.7
- 2.17.6
- 2.17.5
- 2.17.4
- 2.17.3
- 2.17.2
- 2.17.1
- 2.17.0
- 2.16.0
- 2.15.2
- 2.15.1
- 2.15.0
- 2.14.1
- 2.14.0
- 2.13.0
- 2.12.1
- 2.12.0
- 2.11.0
- 2.10.2
- 2.10.1
- 2.10.0
- 2.9.2
- 2.9.1
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.1
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.2
- 1.0.1
- dev-m-2.4.1
- dev-pr/ainarssondors/30-2
- dev-performance
- dev-revert-18-klarna
- dev-braintree
This package is auto-updated.
Last update: 2024-09-14 20:55:58 UTC
README
QuoteGraphQl 提供了 Checkout 步骤的基本类型和解析器。
端点描述
此处所有端点应接受与 API 相同的数据。有关 API 参考,请参阅 此链接
重要提示:以下的所有突变和查询操作无需指定
quote_id
参数(或quoteId
)。如果没有指定任何报价 ID,解析器将尝试从 Auth 标头中加载报价 ID,其中应包含身份验证令牌。如果传递了 quoteId,它将视为客户请求,因此quote_id
应该进行编码。
重要提示:此端点是 Magento 2 GraphQL Quote 端点 的替代方案,该端点在服务器上存储授权客户的
quote_id
(使用 state-full 方法)。
getCartForCustomer
此端点允许获取完整的购物车数据(项目 + 总计)。
query GetCartForCustomer ($_guestCartId_0: String) { getCartForCustomer(guestCartId: $_guestCartId_0) { id tax_amount subtotal discount_amount subtotal_with_discount grand_total items { item_id qty product { price { maximalPrice { amount { value currency } adjustments { code amount { value currency } } } } } } } }
{ "_guestCartId_0":"xIXmScRLWb5ntIEsYe2ymzrVXYraivGx" }
saveCartItem
cartItem
类型现在实现了 CartItemId 的子类型,允许通过多个之一进行引用:item_id 或产品 SKU。在未来的版本中,当 "sku" 和 "item_id" 被删除时,这将变为非空。
此端点允许根据默认 API 负载数据结构提交项目到购物车。以下示例是将简单产品选项添加到购物车的简单示例。
mutation SaveCartItem ($_cartItem_0: CartItemInput!, $_guestCartId_0: String) { saveCartItem(cartItem: $_cartItem_0, guestCartId: $_guestCartId_0) { getCartForCustomer(guestCartId: $_guestCartId_0) { id tax_amount subtotal discount_amount subtotal_with_discount grand_total items { item_id qty product { price { maximalPrice { amount { value currency } adjustments { code amount { value currency } } } } } } } } }
{ "_cartItem_0":{ "sku":"Test simple product", "product_type":"simple", "qty":1, "product_option": { "extension_attributes":{} } }, "_guestCartId_0":"xIXmScRLWb5ntIEsYe2ymzrVXYraivGx" }
removeCartItem
mutation RemoveCartItem($item_id: Int!, $_guestCartId_0: String) { removeCartItem(item_id: $item_id, guestCartId: $_guestCartId_0) { getCartForCustomer(guestCartId: $_guestCartId_0) { id tax_amount subtotal discount_amount subtotal_with_discount grand_total items { item_id qty product { price { maximalPrice { amount { value currency } adjustments { code amount { value currency } } } } } } } } }
{ "item_id": 1, "quoteId": "s44Xcnya8dmbysAeNTOozFsZCh8tyCH9" }
estimateShippingCosts
mutation EstimateShippingCosts( $guestCartId: String! $address: EstimateShippingCostsAddress! ) { estimateShippingCosts(address: $address, guestCartId: $guestCartId) { carrier_code method_code carrier_title method_title error_message amount base_amount price_excl_tax price_incl_tax available } }
{ "guestCartId": "s44Xcnya8dmbysAeNTOozFsZCh8tyCH9", "address": { "region": "New York", "region_id": 43, "region_code": "NY", "country_id": "US", "street": [ "123 Oak Ave" ], "postcode": "10577", "city": "Purchase", "firstname": "Jane", "lastname": "Doe", "customer_id": 4, "email": "jdoe@example.com", "telephone": "(512) 555-1111", "same_as_billing": 1 } }
saveAddressInformation
mutation SaveAddressInformation( $addressInformation: SaveAddressInformation! $guestCartId: String ) { saveAddressInformation( addressInformation: $addressInformation, guestCartId: $guestCartId ) { payment_methods { code title } totals { grand_total items { name qty } } } }
{ "guestCartId": "s44Xcnya8dmbysAeNTOozFsZCh8tyCH9", "addressInformation":{ "shipping_address":{ "region":"New York", "region_id":43, "region_code":"NY", "country_id":"US", "street":[ "123 Oak Ave" ], "postcode":"10577", "city":"Purchase", "firstname":"Jane", "lastname":"Doe", "email":"jdoe@example.com", "telephone":"512-555-1111" }, "billing_address":{ "region":"New York", "region_id":43, "region_code":"NY", "country_id":"US", "street":[ "123 Oak Ave" ], "postcode":"10577", "city":"Purchase", "firstname":"Jane", "lastname":"Doe", "email":"jdoe@example.com", "telephone":"512-555-1111" }, "shipping_carrier_code":"flatrate", "shipping_method_code":"flatrate" } }
savePaymentInformationAndPlaceOrder
mutation SavePaymentInformationAndPlaceOrder( $paymentInformation: PaymentInformation!, $guestCartId: String, ) { savePaymentInformationAndPlaceOrder( paymentInformation: $paymentInformation, guestCartId: $guestCartId ) { orderID } }
{ "guestCartId": "s44Xcnya8dmbysAeNTOozFsZCh8tyCH9", "paymentInformation": { "paymentMethod": { "method": "checkmo" }, "billing_address":{ "region":"New York", "region_id":43, "region_code":"NY", "country_id":"US", "street":[ "123 Oak Ave" ], "postcode":"10577", "city":"Purchase", "firstname":"Jane", "lastname":"Doe", "email":"jdoe@example.com", "telephone":"512-555-1111" } } }