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

Out of stock products appear in Filtered Results #65

Open
1 task done
lfinsaas opened this issue Mar 28, 2023 · 5 comments
Open
1 task done

Out of stock products appear in Filtered Results #65

lfinsaas opened this issue Mar 28, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@lfinsaas
Copy link

lfinsaas commented Mar 28, 2023

Describe the bug

Hi folks,

Loving the tool so far (very fast!) but we're running into an issue with the filters. They do not appear to be hooking into product variations' stock status. From what I can tell, if the product has the attribute, EP will pull the product into the output — despite the Woo setting to hide out of stock items. This makes it pretty much impossible for customers to navigate the Clearance section of the site, as sizes are pretty spotty.

Any ideas? Do we need to add a filter of some sort?

Thanks!

Steps to Reproduce

  1. Go to https://jaxengrey.com/product-tag/clearance/
  2. Filter on Sizes —> Large
  3. Click on the Ponto Performance Pant (https://jaxengrey.com/product/ponto-performance-pant-chestnut-heather/)
  4. No Large in Stock!

Screenshots, screen recording, code snippet

Screenshot 2023-03-28 at 13 36 41

Screenshot 2023-03-28 at 13 36 54

Environment information

Macbook
OS 13.0.1 (22A400)
Chrome 111.0.5563.110

WordPress and ElasticPress information

Up to Date (can provide status again if necessary)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@lfinsaas lfinsaas added the bug Something isn't working label Mar 28, 2023
@burhandodhy
Copy link
Contributor

Hi @lfinsaas,

I can confirm that it's a bug. We are going to work on the fix, and it will be available in a future release.

Regards,
Burhan

@lfinsaas
Copy link
Author

Any workarounds in the meantime?

Would implementing the method outlined in Issue 10up/ElasticPress#2473 (sorting out of stock items to the back) hook into these variable products?

@burhandodhy
Copy link
Contributor

We apologize for the inconvenience. I just tested again, and everything is working as expected. When "Out of stock visibility" is enabled. WooCommerce only hides the simple product from the shop page; the Variable product remains displayed. The behavior is the same for the ElasticPress filters.

@lfinsaas
Copy link
Author

lfinsaas commented Apr 3, 2023

Uh, OK?

Sure, EP aligns with standard Woo behavior — but EP extends Woo functionality, right?

Removing product variations w/o stock from the query seems like a pretty basic function that EP should be able to tackle.

Are there workarounds in the meantime?

If nothing else, can this be added to a feature roadmap?

Thank you.

@felipeelia felipeelia self-assigned this Apr 4, 2023
@felipeelia
Copy link
Member

Hi @lfinsaas,

Although it may seem like a pretty basic function, it is not. The query that fetches products matches only parent products and not variations. As the variation availability is not something that belongs directly to the parent product, it is not something we could filter on.

To have that working, ElasticPress would need to:

  1. Inject in the parent product the availability of its variations and keep it updated
  2. Detect:
    • if the WooCommerce setting is turned on
    • if a Facet filter is applied to the current query
    • then filter out all parent products with variations belonging to what's been filtered that are out of stock.

Number 1 isn't easy (more a writing chore than anything) but nr. 2 is a big lift.

I'm changing this issue to enhancement now. Any Pull Requests to have that done are welcome. Thanks

@felipeelia felipeelia added enhancement New feature or request and removed bug Something isn't working labels Apr 20, 2023
@felipeelia felipeelia changed the title BUG: Out of stock products appear in Filtered Results Out of stock products appear in Filtered Results Apr 20, 2023
@felipeelia felipeelia removed their assignment Apr 20, 2023
@felipeelia felipeelia transferred this issue from 10up/ElasticPress Apr 21, 2023
@felipeelia felipeelia added this to the Future Release milestone Apr 21, 2023
@MARQAS MARQAS self-assigned this Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants