Code Monkey home page Code Monkey logo

api-plugin-carts's People

Contributors

akarshit avatar aldeed avatar brent-hoover avatar dependabot[bot] avatar focusaurus avatar kieckhafer avatar mikemurray avatar mohannarayana avatar snyk-bot avatar tedraykov avatar trojanh avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-plugin-carts's Issues

add peerDependency for Tags plugin

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.

Cannot extend cart schema

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;

Build fulfillment groups mechanism makes it impossible to build custom groups

Prerequisites

  • [ + ] Are you running the latest version?
  • [ + ] Are you able to consistently reproduce the issue?
  • [ + ] Did you search the issue queue for existing issue? Search issues

Issue Description

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.

Possible Solution

In updateCartFulfillmentGroups determine if the items is already allocated to the group, if so, do not re-allocate.

Versions

2.x, 3.x

ProductConfiguration not provided in anonymousCartByCartId query

Prerequisites

  • Are you running the latest version?
  • Are you able to consistently reproduce the issue?
  • Did you search the issue queue for existing issue? Search issues

Issue Description

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.

Steps to Reproduce

  1. Run the query anonymousCartByCartIdQuery in the playground for an anonymous cart.

Possible Solution

Could be that the fields are not included in the item object when it's getting the data from the mongo collection.

Versions

3.7.1

the possibility to choose several variants as in the case of a color and size variant

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.

My Solution

{
  "Cart" : {
     ...
     products: ["productId":....,
"shopId":.....,
"addedAt":....,
"position": ....,
"quantity":.....,
         "items": []
     ]
  }
}

is to group the selection items of each catalog product.

imageURLs missing in CartItem

Issue Description

When querying for the images of a cart item, a null value is returned even for items that have images defined.

  • Are you running the latest version?
  • Are you able to consistently reproduce the issue?
  • Did you search the issue queue for existing issue?

Steps to Reproduce

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
          }
        ]
      }
    }
  }
}

Possible Solution

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.

Versions

4.0.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.