reactioncommerce / api-plugin-carts Goto Github PK
View Code? Open in Web Editor NEWCarts plugin for the Reaction API
License: GNU General Public License v3.0
Carts plugin for the Reaction API
License: GNU General Public License v3.0
This plugin uses the Address
, and AddressInput
types in GraphQL, which live in the address-validation plugin.
When work is done to move this plugin, we need to be sure to install api-plugin-address-validation
as a peerDependency
.
Carts uses the TagSortByField
and TagConnection
type in GraphQL, which lives in the tags plugin.
When work is done to move carts over here, we need to be sure to install api-plugin-tags as a peerDependency.
In the transformAndValidateCart mutation the cart schema is loaded directly from file as import { Cart as CartSchema } from "../simpleSchemas.js";
. It makes it impossible to extend the cart schema as the validation fails. The schema should be retrieved from the context as follows: const CartSchema = context.simpleSchemas.Cart;
Currently every time the cart gets updated (add item, remove item, set shipping address etc) the transformAndValidateCart
method is being called, which in turn calls updateCartFulfillmentGroups
.
This works well when there is no need to build custom fulfillment groups or allow customer to place cart items in specific groups.
This is because updateCartFulfillmentGroups
is destructive, it will iterate over each cart item to determine the group it should belong to based on the supported shipping type. The item ends up being re-allocated even if it was previously assigned to a specific group by the customer or some other underlying mechanism.
In updateCartFulfillmentGroups
determine if the items is already allocated to the group, if so, do not re-allocate.
2.x, 3.x
Prerequisites
When I query the cart for the productConfiguration
field, I get this error:
"message": "Cannot return null for non-nullable field CartItem.productConfiguration.",
"locations": [
{
"line": 34,
"column": 11
}
],
"path": [
"anonymousCartByCartId",
"checkout",
"fulfillmentGroups",
0,
"items",
0,
"productConfiguration"
],
When checking the plugin, productConfiguration
is based on item.productId
and item.variantId
. Both exist in the database on the CartItem
object.
anonymousCartByCartIdQuery
in the playground for an anonymous cart.Could be that the fields are not included in the item object when it's getting the data from the mongo collection.
3.7.1
If we take the example of a product with two variants color and size, therefore to add product in cart we must select a color in variant colors and a size in variant sizes.
With the structure of the cart we won't be able to do this kind of manipulation.
{
"Cart" : {
...
products: ["productId":....,
"shopId":.....,
"addedAt":....,
"position": ....,
"quantity":.....,
"items": []
]
}
}
is to group the selection items of each catalog product.
Discussion in PR #30
Remove OR condition in DB query. Handle case where anonymousAccessToken is sent hashed and not hashed.
When querying for the images of a cart item, a null
value is returned even for items that have images defined.
Running the following query for a cart that has an item with images:
query anonymousCartByCartIdQuery(
$cartId: ID!
$cartToken: String!
$itemsAfterCursor: ConnectionCursor
) {
cart: anonymousCartByCartId(cartId: $cartId, cartToken: $cartToken) {
items(first: 20, after: $itemsAfterCursor) {
nodes {
imageURLs {
large
small
original
medium
thumbnail
}
}
}
}
}
Returns:
{
"data": {
"cart": {
"items": {
"nodes": [
{
"imageURLs": null
}
]
}
}
}
}
Looking into the code looks like nowhere in the resolvers the imageURLs
property is set.
A possible solution is to query the needed media in the CartItem resolver, similar to how it's done in the products plugin.
4.0.0
Carts uses the Address
type in GraphQL, which lives in the accounts plugin.
When work is done to move carts
over here, we need to be sure to install api-plugin-accounts
as a peerDependency
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.