'Spree, update the default behavior to search products in taxon his children

In my Spree app, I have a Taxon with id 5, who have children taxons.

When I search products via API, I can add a taxon_id like this:

/api/v2/storefront/products?filter[taxons]=5

All products who belong to the taxon with id 5 are present, but no one who belong to a child taxon of taxon 5

I know an existing scope in_taxon do exactly what I want, because if I do in the rails console: Spree::Product.in_taxon(Spree::Taxon.find(5)) I have all products I desire.

My question is: Where can I configure Spree, to tell him to use this existing scope instead his actual behavior?

Tanks

Spree: 4.2.5



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source