Magento2: Filtering by url_key doesn't work in GraphQL Products Query

Created on 31 Mar 2020  路  6Comments  路  Source: magento/magento2

Preconditions

  1. Magento 2.3.4

Steps to reproduce

  1. Create a product and set the url key to 'my-test-product'
  2. Submit the following Graph QL query:
{
  products(
    filter: {
        url_key: {
          eq: "my-test-product"
        }
    }
  ) {
    total_count,
    items {
      id,
      sku,
      url_key,
      name
    }
  }
}

Expected result

Only that single product should be returned in the items

Actual result

All products are returned. url_key is completely ignored.

Format is valid Reported on 2.3.4

Most helpful comment

If anyone runs into this same issue, it would appear to be a problem with the M1 migration tool. The product url_key attribute had the Use in Search value set to No. Changing this to Yes fixed my issue.

All 6 comments

Hi @paul-blundell. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@paul-blundell do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

@magento give me 2.3.4 instance

Hi @paul-blundell. Thank you for your request. I'm working on Magento 2.3.4 instance for you

Hi @paul-blundell, here is your Magento instance.
Admin access: https://i-27518-2-3-4.instances.magento-community.engineering/admin_0b63
Login: ea2f7963 Password: 111562a3dcf7
Instance will be terminated in up to 3 hours.

Unable to reproduce on the fresh instance.

This must be an issue somewhere in my local install.

If anyone runs into this same issue, it would appear to be a problem with the M1 migration tool. The product url_key attribute had the Use in Search value set to No. Changing this to Yes fixed my issue.

Was this page helpful?
0 / 5 - 0 ratings