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

Unknown argument "hasProduct" on "variants" #1697

Closed
Saboteur777 opened this issue Sep 2, 2020 · 2 comments
Closed

Unknown argument "hasProduct" on "variants" #1697

Saboteur777 opened this issue Sep 2, 2020 · 2 comments
Assignees
Labels

Comments

@Saboteur777
Copy link
Contributor

Description
According to the documentation there should be a hasProduct parameter, but it seems to be broken: 

{
 variants(
 status: "enabled"
 limit: null
 orderBy: "title ASC"
 trainingDays: 83221,
 hasProduct: {limit:null, status: "enabled", relatedTo: 109}
) {
 title
}
{
  "errors": [
    {
      "message": "Unknown argument \"hasProduct\" on field \"variants\" of type \"Query\". Did you mean \"hasStock\"?",
      "category": "graphql",
      "locations": [
        {
          "line": 7,
          "column": 5
        }
      ]
    }
  ]
}

The same seems to be working in PHP:

$productQuery = Product::find()
 ->limit(null)
 ->status('enabled')
 ->relatedTo(109);

$variants = Variant::find()
 ->status('enabled')
 ->limit(null)
 ->orderBy('title ASC')
 ->trainingDays(83223)
 ->hasProduct($productQuery)
 ->all();

Additional info

  • Craft version: 3.5.8
  • Commerce version: 3.2.3
  • PHP version: 7.4.2
  • Database driver & version: MySQL 5.5.5

Additional context
See request n. 8822.

@Saboteur777 Saboteur777 added the New label Sep 2, 2020
@nfourtythree nfourtythree added 👚 products 💡 enhancement Ideas and suggestions and removed New labels Sep 3, 2020
@nfourtythree nfourtythree self-assigned this Sep 3, 2020
@nfourtythree
Copy link
Contributor

Hi

We have just pushed an update that adds hasProduct parameter to variant GraphQL queries.

This will be included in the next release of Commerce.

Thanks!

@Saboteur777
Copy link
Contributor Author

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants