scandipwa/quote-graphql
Composer 安装命令:
composer require scandipwa/quote-graphql
包简介
N/A
README 文档
README
QuoteGraphQl provides basic types and resolvers for Checkout steps.
Endpoint description
All endpoints here should accept the same data as the API does. For an api reference, please follow this link
IMPORTANT NOTE: every following mutation and query work without specifying the
quote_idparam (orquoteId). If none quote id is specified the resolver will attempt to load the quote id from Auth header, where auth token should be present. If quoteId is passed, it will treat it as a guest request, so thequote_idshould be encoded.
IMPORTANT NOTE: this endpoint is an alternative for Magento 2 GraphQL Quote endpoint that is storing
quote_idfor authorized customer on server (using state-full approach).
getCartForCustomer
This endpoint allows to get full cart data (items + totals).
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
type cartItem now implements sub-type of CartItemId, that allows to reference by one of many:
item_id or product SKU. This will become non-nullable in the future releases, when "sku" and "item_id" will be dropped.
This endpoint allows to submit items to cart following the default API payload schema. In beneath example is a simple product option addition to cart.
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"
}
}
}
scandipwa/quote-graphql 适用场景与选型建议
scandipwa/quote-graphql 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 236.3k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2019 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 scandipwa/quote-graphql 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 scandipwa/quote-graphql 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 236.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 9
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: OSL-3.0
- 更新时间: 2019-04-12