Skip to content

Comments

Add WooCommerce My Account Customizations#1

Open
krugazul wants to merge 1 commit intosetup/initial-configfrom
setup/my-account
Open

Add WooCommerce My Account Customizations#1
krugazul wants to merge 1 commit intosetup/initial-configfrom
setup/my-account

Conversation

@krugazul
Copy link

Overview

This PR adds a new My_Account class to customize WooCommerce My Account endpoints.

Changes Made

New Files

  • inc/class-my-account.php: New class for WooCommerce My Account customizations

Modified Files

  • inc/class-core.php: Added My_Account class initialization and loading

Features Implemented

✅ Renamed Endpoints

  • Dashboard → Dashboard Overview
  • Subscriptions → Subscriptions & Payments
  • Account details → Profile & Professional Details

✅ Disabled Endpoints

  • Address (edit-address)
  • Downloads
  • Orders

✅ New Custom Endpoints

  • CPD Points and Certificates
  • Multi Page Report

Implementation Details

The My_Account class:

  • Uses woocommerce_account_menu_items filter to customize menu items
  • Registers custom rewrite endpoints for new pages
  • Provides blank template functions with action hooks for easy content extension
  • Auto-initializes through the Core class

Post-Merge Steps

After merging and activating the plugin:

  1. Flush permalinks: Navigate to Settings → Permalinks and click "Save Changes"
  2. Add content: Hook into ma_plugin_cpd_points_content and ma_plugin_multi_page_report_content action hooks to add custom content

Testing

  • Verify menu items are renamed correctly
  • Confirm disabled endpoints are hidden
  • Test custom endpoints are accessible after flushing permalinks
  • Validate action hooks work for adding content

@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

.coderabbit.yml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: '$schema', 'path_filters', 'auto_review', 'path_instructions'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • 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
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch setup/my-account

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @krugazul, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the WooCommerce My Account experience by introducing a dedicated class for comprehensive customization. It renames key navigation items, removes irrelevant sections, and integrates new custom pages, providing a more tailored and streamlined user interface for account management. The changes are designed to be easily extensible, allowing for future content integration via action hooks.

Highlights

  • New My Account Customization Class: A new My_Account class has been introduced to centralize and manage all WooCommerce My Account customizations.
  • Endpoint Renaming: Existing My Account endpoints have been renamed for clarity: 'Dashboard' to 'Dashboard Overview', 'Subscriptions' to 'Subscriptions & Payments', and 'Account details' to 'Profile & Professional Details'.
  • Endpoint Disablement: Several default My Account endpoints, including 'Address', 'Downloads', and 'Orders', have been disabled and removed from the menu.
  • Custom Endpoints Added: Two new custom endpoints, 'CPD Points and Certificates' and 'Multi Page Report', have been added to the My Account section, complete with action hooks for content extension.
  • Automatic Initialization: The new My_Account class is automatically initialized and loaded through the main Core class of the plugin.
Changelog
  • inc/class-core.php
    • Initialized the new My_Account class within the constructor.
    • Added require_once statement for class-my-account.php in load_classes method.
  • inc/class-my-account.php
    • Added a new class My_Account to handle WooCommerce My Account customizations.
    • Implemented customize_menu_items method to rename and hide default menu items and add custom ones.
    • Included register_custom_endpoints method to define new rewrite endpoints for custom pages.
    • Provided cpd_points_content and multi_page_report_content methods with action hooks for custom content.
    • Added flush_rewrite_rules method to ensure permalinks are updated upon plugin activation.
Activity
  • The pull request introduces new functionality and modifications to existing files.
  • No specific reviewer comments or interactions have been recorded yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces customizations for the WooCommerce My Account page by adding a new My_Account class. The changes include renaming, disabling, and adding new menu endpoints. The implementation is mostly solid, but there is a critical issue with how rewrite rules are flushed on plugin activation. The current approach uses the activated_plugin hook incorrectly, which can lead to performance problems on the site. My review includes a detailed explanation of the issue and a recommendation for the correct implementation using register_activation_hook.

Comment on lines +36 to +37
// Flush rewrite rules on plugin activation (use WordPress activation hooks).
add_action( 'activated_plugin', array( $this, 'flush_rewrite_rules' ) );

Choose a reason for hiding this comment

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

critical

Using the activated_plugin hook to flush rewrite rules is incorrect and can cause site-wide performance issues. This hook fires when any plugin is activated, not just yours, leading to frequent and unnecessary calls to the expensive flush_rewrite_rules() function.

The standard WordPress approach is to use register_activation_hook() in your main plugin file (ma-plugin.php). This hook should be removed from this class and the logic moved to the main plugin file.

Comment on lines +140 to +143
public function flush_rewrite_rules() {
$this->register_custom_endpoints();
flush_rewrite_rules();
}

Choose a reason for hiding this comment

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

critical

This method is related to the incorrect activated_plugin hook and should be removed from this class. The logic for flushing rewrite rules should be moved to an activation hook in the main plugin file, as mentioned in the other comment. This will ensure that rewrite rules are flushed only when your plugin is activated.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant