Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Fix filtering by product type on Store API #4422

Merged
merged 3 commits into from Jul 5, 2021
Merged

Fix filtering by product type on Store API #4422

merged 3 commits into from Jul 5, 2021

Conversation

VoHoTv
Copy link
Contributor

@VoHoTv VoHoTv commented Jul 2, 2021

I moved the $tax_query variable above the code where filtering happens for the product type. The reason for this change is to avoid resetting the $tax_query after a product type is specified for filtering. Which leaves you with an unfiltered product type result.

@VoHoTv VoHoTv requested a review from a team as a code owner July 2, 2021 12:54
@VoHoTv VoHoTv requested review from frontdevde and removed request for a team July 2, 2021 12:54
@senadir
Copy link
Member

senadir commented Jul 2, 2021

Hey, @VoHoTv Thank you for your PR!
Can you add testing notes so I can reproduce the original issue?

@VoHoTv
Copy link
Contributor Author

VoHoTv commented Jul 2, 2021

Hey, @VoHoTv Thank you for your PR!
Can you add testing notes so I can reproduce the original issue?

Hi, sure. To reproduce the original error go to to /wp-json/wc/store/products?type=simple and you will see that the product type filter does not work and instead lists products without regard to the product type.

@senadir senadir changed the title Fixed $tax_query being set to an empty array Fix filtering by product type on Store API Jul 2, 2021
@senadir senadir added the type: bug The issue/PR concerns a confirmed bug. label Jul 2, 2021
@senadir senadir added this to the 5.5.0 milestone Jul 2, 2021
@senadir
Copy link
Member

senadir commented Jul 2, 2021

Thank you! works as expected, will merge after tests pass.

@senadir senadir merged commit a855ebc into woocommerce:trunk Jul 5, 2021
@VoHoTv VoHoTv deleted the fix-tax-query branch September 13, 2021 08:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants