Commerce: GraphQL - Product variant field inside matrix field has type of string

Created on 5 May 2020  路  2Comments  路  Source: craftcms/commerce

Description

I am trying to create a Product variant that includes a matrix field.
That matrix field has a child field that allows selection of a product variant (from a different product type).

querying this field via the GraphQL explorer returns an error as it is typed as a String instead of a Commerce Variant.

"debugMessage": "Expected a value of type \"String\" but received: [{\"productId\":\"38049\",\"isDefault\":\"0\",\"sku\":\"some-sku\",\"price\":\"150.0000\",\"sortOrder\":\"2\",\"width\":\"0.0000\",\"height\":\"0.0000\",\"length\":\"0.0000\",\"weight\":\"0.0000\",\"stock\":\"0\",\"hasUnlimitedStock\":\"1\",\"minQty\":null,\"maxQty\":null,\"deletedWithProduct\":false,\"id\":\"38051\",\"tempId\":null,\"draftId\":null,\"revisionId\":null,\"uid\":\"fafaa640-3f5a-4e8c-a0ee-f75c0dffa6ad\",\"fieldLayoutId\":\"175\",\"structureId\":null,\"contentId\":\"37989\",\"enabled\":\"1\",\"archived\":\"0\",\"siteId\":\"1\",\"title\":\"Some Title\",\"slug\":null,\"uri\":null,\"dateCreated\":{\"date\":\"2020-05-05 06:37:29.000000\",\"timezone_type\":3,\"timezone\":\"UTC\"},\"dateUpdated\":{\"date\":\"2020-05-05 06:37:29.000000\",\"timezone_type\":3,\"timezone\":\"UTC\"},\"dateDeleted\":null,\"root\":null,\"lft\":null,\"rgt\":null,\"level\":null,\"searchScore\":null,\"trashed\":false,\"awaitingFieldValues\":false,\"propagating\":false,\"propagateAll\":false,\"newSiteIds\":[],\"resaving\":false,\"duplicateOf\":null,\"previewing\":false,\"hardDelete\":false}]",

Steps to reproduce

  1. Create a matrix field with a child field of Commerce Variant
  2. create product type that allows variants.
  3. Add matrix field to Product type
  4. create product with variants.
  5. select variant in the matrix field.
  6. query product variant matrix fields via graphql

Additional info

  • Craft version: 3.4.17.1
  • PHP version: 7.3.11
  • Database driver & version: MySQL 5.7.21
  • Plugins & versions: Craft Commerce | 3.1.3
馃悶 bug

Most helpful comment

Thank you! That was lightning fast

All 2 comments

HI @nicholashu

Thank you for bringing this to our attention.

A fix for this has been pushed and will be included in the next release.

Thanks!

Thank you! That was lightning fast

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lukeholder picture lukeholder  路  3Comments

JayBox325 picture JayBox325  路  7Comments

codyjames picture codyjames  路  6Comments

alexanderloewe picture alexanderloewe  路  4Comments

sjcallender picture sjcallender  路  6Comments