Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Cannot return null for non-nullable field SelectedCustomizableOptionValue.sort_order and Call to a member function getPriceType() on null #474

Closed
TomashKhamlai opened this issue Mar 14, 2019 · 1 comment
Assignees
Labels
bug Something isn't working Component: QuoteGraphQl

Comments

@TomashKhamlai
Copy link
Contributor

Cannot return null for non-nullable field SelectedCustomizableOptionValue.sort_order when querying "customizable_options.values" on SimpleCartItem during addProductToCart mutation

Preconditions (*)

  1. Registered Customer
  2. Simple Product with required custom options of type Checkbox, Radio, Dropdown, Multiple Select

Steps to reproduce (*)

  1. Generate Customer token
  2. Create empty cart as Registered Customer from GraphQL Client
  3. Perform mutation:
mutation {
  addSimpleProductsToCart(
    input: {
      cart_id: "WrZmnp35rmaMjIsULMutGQx6GF8yHF2H"
      cartItems: {
        data: {
          qty: 1
          sku: "simple-product-2"
        }
        customizable_options: [
          {
            id: 7
            value: "1"
          }
          {
            id: 8
            value: "3"
          }
          {
            id: 9
            value: "[5]"
          }
          {
            id: 10
            value: "[7]"
          }
        ]
      }
    }
  ) {
    cart {
      items {
        product {
          sku
        }
        ... on SimpleCartItem {
          customizable_options {
            id
            is_required
            values {
              sort_order
            }
          }
        }
      }
    }
  }
}

Expected result (*)

  1. Custom options like Checkbox, Radio, Dropdown, Multiple Select returns valid value of sort order
  2. Other Custom options should provide "sort_order": "1", or just silently skip "sort_order" for those options.

Actual result (*)

  1. Internal server error:
{
  "errors": [
    {
      "debugMessage": "Cannot return null for non-nullable field SelectedCustomizableOptionValue.sort_order.",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 13,
          "column": 15
        }
      ],
      "path": [
        "addSimpleProductsToCart",
        "cart",
        "items",
        0,
        "customizable_options",
        0,
        "values",
        0,
        "sort_order"
      ]
    },
    {
      "debugMessage": "Cannot return null for non-nullable field SelectedCustomizableOptionValue.sort_order.",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 13,
          "column": 15
        }
      ],
      "path": [
        "addSimpleProductsToCart",
        "cart",
        "items",
        0,
        "customizable_options",
        1,
        "values",
        0,
        "sort_order"
      ]
    },
    {
      "debugMessage": "Cannot return null for non-nullable field SelectedCustomizableOptionValue.sort_order.",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 13,
          "column": 15
        }
      ],
      "path": [
        "addSimpleProductsToCart",
        "cart",
        "items",
        0,
        "customizable_options",
        2,
        "values",
        0,
        "sort_order"
      ]
    },
    {
      "debugMessage": "Cannot return null for non-nullable field SelectedCustomizableOptionValue.sort_order.",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 13,
          "column": 15
        }
      ],
      "path": [
        "addSimpleProductsToCart",
        "cart",
        "items",
        0,
        "customizable_options",
        3,
        "values",
        0,
        "sort_order"
      ]
    },
    {
      "debugMessage": "Call to a member function getPriceType() on null",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 9,
          "column": 11
        }
      ],
      "path": [
        "addSimpleProductsToCart",
        "cart",
        "items",
        1,
        "customizable_options"
      ]
    }
  ],
  "data": {
    "addSimpleProductsToCart": {
      "cart": {
        "items": [
          {
            "product": {
              "sku": "simple-product-2"
            },
            "customizable_options": [
              {
                "id": 7,
                "is_required": 1,
                "values": [
                  null
                ]
              },
              {
                "id": 8,
                "is_required": 1,
                "values": [
                  null
                ]
              },
              {
                "id": 9,
                "is_required": 1,
                "values": [
                  null
                ]
              },
              {
                "id": 10,
                "is_required": 1,
                "values": [
                  null
                ]
              }
            ]
          },
          {
            "product": {
              "sku": "simple-product-2"
            },
            "customizable_options": null
          }
        ]
      }
    }
  }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Component: QuoteGraphQl
Projects
None yet
Development

No branches or pull requests

3 participants