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

Compatibility with WooCommerce HPOS #3476

Open
1 task done
felipeelia opened this issue May 31, 2023 · 4 comments
Open
1 task done

Compatibility with WooCommerce HPOS #3476

felipeelia opened this issue May 31, 2023 · 4 comments

Comments

@felipeelia
Copy link
Member

felipeelia commented May 31, 2023

Is your enhancement related to a problem? Please describe.

This issue is to investigate ElasticPress's compatibility with WooCommerce High-Performance Order Storage.

My findings so far:

  • 100% compatibility would be very hard to achieve, as data requests to the new custom table are spread throughout the code base, like here, for example;
  • It seems the best candidate for a replacement with a compatibility layer would be the OrdersTableQuery class, as it is responsible for running queries
  • The OrdersTableQuery class is called directly by the OrdersTableDataStore class here, so we might need to override that one too.
  • Due to the way the WC container works, it won't allow us to simply replace a class, so we might need a new filter to be added.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@felipeelia felipeelia added this to the 5.0.0 milestone May 31, 2023
@vedanshujain
Copy link

Hey @felipeelia , from WC team here. I would love to help you with HPOS compatibility for ElasticPress. It looks like currently you hook into posts_pre_query to hijack WP query and populate results from elasticsearch, would be happy to add similar filter for HPOS as well. It seems we won't need to create new index for HPOS orders, since there is already a allowlist for what data can be synced, and we can add HPOS orders in the same index (note that we always insert a shop_order_placehold post and use the same ID in order tables, so a ID conflict won't happen).

Let us know if there is anything else you would need besides an equivalent posts_pre_query filter.

@felipeelia
Copy link
Member Author

@vedanshujain you got it right. It is worth saying though that an equivalent filter for posts_pre_query would be a good start, but we will probably need some further changes, especially given the number of times the code seems to be touching the database directly.

@vedanshujain
Copy link

Cool cool, we will get a PR started for posts_pre_query. Please let us know what you discover during development, we would be happy to add more action/filters where they makes sense, and especially if a similar filter already exists with the posts.

@vedanshujain
Copy link

@felipeelia , I can try and give it a shot for a draft PR, if this is still on the roadmap?

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

2 participants