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

BUG: Woo Commmerce Product Search broken #2371

Closed
notdian opened this issue Sep 27, 2021 · 12 comments
Closed

BUG: Woo Commmerce Product Search broken #2371

notdian opened this issue Sep 27, 2021 · 12 comments
Assignees
Milestone

Comments

@notdian
Copy link

notdian commented Sep 27, 2021

Hello all,

Woocommerce blocks have implemented their own search functionality which elasticpress ignores leading to incorrect results (On the handpicked products block you can't access products if they're not on the first 100 products), changing search to s fixes the issue, maybe we should add a case to interpret search as s in the woocommerce feature, or disable ep_integration on these queries.

@notdian notdian added the bug Something isn't working label Sep 27, 2021
@mckdemps mckdemps added this to the 3.6.4 milestone Sep 28, 2021
@felipeelia
Copy link
Member

Hi @dianfishekqi. I made a few tests locally but I'd like to understand better what is your ask here. It seems ElasticPress is NOT used, right? Are you wanting to enable the integration for that query? Thanks!

@notdian
Copy link
Author

notdian commented Oct 1, 2021

@felipeelia ElasticPress is enabled by default unless you set ep_integrate to false, elastic press does not handle the search param as it is not something standard, we have to options to disable ep_integrate for that query or alias search to s

@felipeelia felipeelia removed this from the 3.6.4 milestone Oct 12, 2021
@felipeelia
Copy link
Member

Hi @dianfishekqi. ElasticPress would not be enabled by default for queries that don't have s nor ep_integrate set. Can you please give us a step-by-step of how we can reproduce it and how you are debugging it? Also, which features do you have enabled? Thanks

@notdian
Copy link
Author

notdian commented Oct 12, 2021

hi @felipeelia,
as you can see here, the condition is isset( $query->query_vars['ep_integrate'] ) && false === $query->query_vars['ep_integrate'] ), meaning only if ep_integrate is set and false only then the integration will be disabled, which enabled it by default unless one of the other cases fails. I have edited the source of the woocommerce product query on my server which then fixed the problem, so I'm pretty sure that is the problem. If you still need detailed steps to reproduce I can provide you a screencast.

  1. Install WooCommerce
  2. Have more than 100 products
  3. Install ElasticPress (enable woocommerce feature)
  4. Create a new page
  5. Add handpicked products block
  6. search for a product that is not listed in the first 100 results
    7.It will return nothing (js filters the results on frontend)/ the backend always returns the same results as it doesn't take parameter s into account

@oscarssanchez
Copy link
Contributor

Hi @dianfishekqi

A screencast would be great! I've tried to reproduce this by generating products via WPCLI but I still don't understand the scenario where you would not get the product you are looking for.

Thanks!

@github-actions
Copy link

This issue has been automatically closed because there has been no response to our request for more information. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. See this blog post on bug reports and the importance of repro steps for more information about the kind of information that may be helpful.

@notdian
Copy link
Author

notdian commented Jan 19, 2022

Hello @oscarssanchez, here is a screencast of the issue; as you can see after changing the search param of wc-query from search to s it returns more products, the solution might be just disabling the ep_integration on these searches, or altogether disable ep_integrate on all queries which include unknown keys (compare against a whitelist of wp_query params).

Untitled.mp4

@oscarssanchez
Copy link
Contributor

Thanks @dianfishekqi !

I could reproduce it now. I'll add the bug label to this.

@mckdemps mckdemps removed the bug Something isn't working label Jan 25, 2022
@mckdemps mckdemps assigned felipeelia and unassigned oscarssanchez Feb 22, 2022
@notdian
Copy link
Author

notdian commented Feb 28, 2022

Hello @felipeelia ,@mckdemps,
I would be happy to submit a PR for this bug!
Possible solutions I can think of are:

  1. Support the search param if in WooCommerce queries by aliasing it to s
  2. Disable ep_integration on WP_ADMIN queries for products

Thanks,

@felipeelia
Copy link
Member

Hey @dianfishekqi, that is actually excellent timing as I am giving a look into this problem at this exact moment haha. I'll get back to you with my findings and our preferred solution. Thanks!

@felipeelia
Copy link
Member

Hi @dianfishekqi, I've just created #2620 fixing the issue. Would you have an environment where you could test that? As it is now using EP 4.0 code, you'll need to npm install && npm run build to have CSS and JS properly working. Thanks

@felipeelia
Copy link
Member

Closed by #2620

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

No branches or pull requests

4 participants