Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customFields null on graphQl query collection #2171

Closed
getwebM opened this issue May 8, 2023 · 8 comments
Closed

customFields null on graphQl query collection #2171

getwebM opened this issue May 8, 2023 · 8 comments
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@getwebM
Copy link

getwebM commented May 8, 2023

Describe the bug
customFields is null on graphQl query collection

Product with customFields:
image

Query:
image

Response:
image

To Reproduce
Steps to reproduce the behavior:

  1. Create a product with custom Fields
  2. Add Product to collection
  3. Query Collection with productVariants
  4. See customFields are empty

Expected behavior
List of customFields as JSON

Environment (please complete the following information):

  • @vendure/core version: 1.9.5
  • Nodejs version: 14.21.2
  • Database (mysql/postgres etc): 10.5.19-MariaDB-0+deb11u2 - Debian 11
@getwebM getwebM added the type: bug 🐛 Something isn't working label May 8, 2023
@daviddarx
Copy link

I have the same problem: my custom fields are exposed for the products correctly with the product or through the activeOrder queries, but missing through the order and orderByCode queries.

@michaelbromley
Copy link
Member

I think the problem here (in both cases) is that the custom fields are being defined on the Product entity, but both the collection and (I am guessing) your order queries are actually querying ProductVariant rather than Product.

For example, to get the custom fields of the Product from the activeOrder query you would do:

query {
  activeOrder {
    id
    lines {
      productVariant {
        product {
          customFields {
            myCustomField
          }
        }
      }
    }
  }
}

@daviddarx
Copy link

Hi @michaelbromley ,

Thanks for your quick feedback. Hum, I guess my query already was correct, see, if I query the product directly by ID, I get its shortname:
01_product

On the other hand, If I have the product in my order lines with order or orderByCode, the shortname is there null.
02_order
03_orderByCode

Am I missing something?
Thanks in advance!

@michaelbromley michaelbromley moved this to 📋 Backlog in Vendure OS Roadmap Jan 16, 2024
@michaelbromley
Copy link
Member

@daviddarx ok yeah your queries look correct so this seems like a potential bug then. I will investigate at the next opportunity.

Alternatively let's try putting a bounty on it to incentivize others to have a go at solving it:

/bounty $40

Copy link

algora-pbc bot commented Jan 16, 2024

💎 $40 bounty • Vendure

Steps to solve:

  1. Start working: Comment /attempt #2171 with your implementation plan
  2. Submit work: Create a pull request including /claim #2171 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to vendure-ecommerce/vendure!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🔴 @jemiluv8 Jan 16, 2024, 4:51:27 PM WIP
🔴 @oliverqx Jan 23, 2024, 4:14:20 PM #2644

@daviddarx
Copy link

@michaelbromley Great thanks!

oliverqx added a commit to oliverqx/vendure that referenced this issue Jan 23, 2024
@oliverqx
Copy link
Contributor

oliverqx commented Jan 23, 2024

/attempt #2171

Copy link

algora-pbc bot commented Jan 23, 2024

💡 @oliverqx submitted a pull request that claims the bounty. You can visit your bounty board to reward.

@michaelbromley michaelbromley moved this from 📋 Backlog to ✅ Done in Vendure OS Roadmap Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
Status: 🚀 Shipped
Development

No branches or pull requests

4 participants