Skip to content

feat: Add High Performance Order Storage support for WooCommerce compatibility#176

Merged
devAsadNur merged 1 commit into
developfrom
fix/hpos-support
Jun 19, 2025
Merged

feat: Add High Performance Order Storage support for WooCommerce compatibility#176
devAsadNur merged 1 commit into
developfrom
fix/hpos-support

Conversation

@mralaminahamed

@mralaminahamed mralaminahamed commented Jun 17, 2025

Copy link
Copy Markdown
Contributor

This PR adds compatibility for WooCommerce's High-Performance Order Storage (HPOS) feature to the wePOS plugin. When HPOS was enabled, orders were not appearing in the wePOS interface due to incompatible query methods.

Changes made:

  • Added HPOS compatibility declaration using WooCommerce's FeaturesUtil class
  • Added reference link to WooCommerce developer documentation for HPOS query APIs

Changelog entry

- **update**: Added High Performance Order Storage support.

Related Issues

Testing Instructions

  1. Enable HPOS in WooCommerce settings (WooCommerce > Settings > Advanced > Features)
  2. Create test orders with the wePOS interface
  3. Verify orders appear correctly in the wePOS interface
  4. Verify existing orders created via wePOS are properly displayed

Screenshots/Video

described in issue description

Technical Notes

  • The changes follow WooCommerce's recommended approach for HPOS compatibility
  • This is a backward-compatible change that works with both traditional post-based orders and the new custom order tables

Summary by CodeRabbit

  • New Features
    • Added compatibility with WooCommerce's High Performance Order Storage (HPOS) feature, ensuring smoother integration with WooCommerce's custom order tables.

@mralaminahamed mralaminahamed requested a review from mrabbani June 17, 2025 04:01
@mralaminahamed mralaminahamed self-assigned this Jun 17, 2025
@mralaminahamed mralaminahamed added Needs Dev Review This PR needs review by a developer Needs Testing This requires further testing labels Jun 17, 2025
@coderabbitai

coderabbitai Bot commented Jun 17, 2025

Copy link
Copy Markdown

Walkthrough

The WePOS class constructor in wepos.php was updated to add an action hook for before_woocommerce_init, which triggers a new method that declares compatibility with WooCommerce's High Performance Order Storage (HPOS) feature. This ensures the plugin is recognized as compatible with WooCommerce's HPOS system.

Changes

File(s) Change Summary
wepos.php Added WooCommerce HPOS compatibility declaration via new method and action hook in WePOS class

Sequence Diagram(s)

sequenceDiagram
    participant WooCommerce
    participant WePOS

    WooCommerce->>WePOS: before_woocommerce_init action
    WePOS->>WePOS: declare_woocommerce_feature_compatibility()
    alt FeaturesUtil exists
        WePOS->>WooCommerce: FeaturesUtil::declare_compatibility('custom_order_tables', plugin_file, true)
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement compatibility layer for WooCommerce HPOS (custom order tables) (#78, #388)
Remove plugin incompatibility warning with HPOS enabled (#78)
Orders unavailable in wePOS interface with HPOS enabled (#388)
Adapt order data handling to use WooCommerce CRUD APIs instead of direct DB queries (#78) The code only declares compatibility; it does not show adaptation of order data handling.

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Poem

A hop and a skip, a code change so neat,
Now HPOS and wePOS can finally meet!
With tables anew and features declared,
Orders appear—no longer impaired.
So merchants rejoice, let sales never pause,
For rabbits and plugins, we code with applause!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
wepos.php (1)

126-138: Replace placeholder @since tag and consider importing FeaturesUtil
Update the docblock’s @since to the actual plugin version and optionally alias FeaturesUtil for cleaner calls.

Proposed diff:

126c126
- * @since WEPOS_SINCE
+ * @since 1.3.0

Optional import at the top of the file:

+use Automattic\WooCommerce\Utilities\FeaturesUtil;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between babdb26 and dbf41ed.

📒 Files selected for processing (1)
  • wepos.php (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: e2e_api tests
🔇 Additional comments (1)
wepos.php (1)

87-89: Registering HPOS compatibility hook
The before_woocommerce_init hook correctly invokes the compatibility declaration early in WooCommerce’s bootstrap. This ensures HPOS support is declared before WooCommerce finishes initialization.

@dev-shahed dev-shahed added QA Approved This PR is approved by the QA team and removed Needs Testing This requires further testing labels Jun 17, 2025
@mrabbani mrabbani added Urgent and removed Needs Dev Review This PR needs review by a developer labels Jun 17, 2025
@devAsadNur devAsadNur merged commit 619eed9 into develop Jun 19, 2025
1 check passed
@devAsadNur devAsadNur deleted the fix/hpos-support branch June 19, 2025 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

QA Approved This PR is approved by the QA team Urgent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants