My Account Customizer - Compatibility with WoodMart Theme "My Account" widget

Issue #21 resolved
Simon Gevcen | Jeriss Cloud Center ™ created an issue

Please check the screenshot & staging below. You’ll see in the header that I’ve added the widget “My Account” from the Theme WoodMart. When you “hover” on this widget, you get an overview of the endpoints contained in it.

However, the structure isn’t well displayed there. We simply see the endpoints, not the structure. I wish to see the same structure into this. Is this feasible?

For now, I simpy use a “button” with a link rather than this widget. But I wish that your plugin would be compatible with this.

https://wordpress-573315-4072272.cloudwaysapps.com/

Comments (12)

  1. woomatrix support repo owner

    it is quite expected as there is no such thing as group in wooocmmerce core. its just added by our plugin and hooked into template folder. so by default they take registered menu items from wc_get_account_menu_items(); and show them one by one. By default they take group as endpoint.

    I have to look into their source code. if they have hook provided to override only then it could be fixed or if they have separate template for this which is open to override.

  2. Simon Gevcen | Jeriss Cloud Center ™ reporter

    I can send the question to the support of my theme.

    Can you tell me exactly what question I should ask them?

  3. woomatrix support repo owner

    This falls into third party compatibility. anyone of both should provide compatibility for other as none of either is part of woocommerce core. It makes sense for us to provide compatiblity inside our plugin as woodmart has much wider audiance then us. I will be back to you after diving deeper into it.

  4. woomatrix support repo owner

    They do not have any hook to replace existing my account header menu. but if woodmart developers can make some changes in their plugin code , our plugin version higher than 2.2.12 will work with woodmart header my account menu.

    File to edit wp-content\themes\woodmart\inc\integrations\woocommerce\template-tags.php between line 1887-1904 find below given code

    // **********************************************************************//
    // ! My account menu
    // **********************************************************************//
    
    if ( ! function_exists( 'woodmart_get_my_account_menu' ) ) {
        function woodmart_get_my_account_menu() {
            $user_info  = get_userdata( get_current_user_id() );
            $user_roles = $user_info->roles;
    
            $out = '<ul class="wd-sub-menu' . woodmart_get_old_classes( ' sub-menu' ) . '">';
    
            foreach ( wc_get_account_menu_items() as $endpoint => $label ) {
                $out .= '<li class="' . wc_get_account_menu_item_classes( $endpoint ) . '"><a href="' . esc_url( wc_get_account_endpoint_url( $endpoint ) ) . '"><span>' . esc_html( $label ) . '</span></a></li>';
            }
    
            return $out . '</ul>';
        }
    }
    

    and replace it with

    // **********************************************************************//
    // ! My account menu
    // **********************************************************************//
    
    if ( ! function_exists( 'woodmart_get_my_account_menu' ) ) {
        function woodmart_get_my_account_menu() {
            $user_info  = get_userdata( get_current_user_id() );
            $user_roles = $user_info->roles;
    
            $out = '<ul class="wd-sub-menu' . woodmart_get_old_classes( ' sub-menu' ) . '">';
    
            foreach ( wc_get_account_menu_items() as $endpoint => $label ) {
                $out .= '<li class="' . wc_get_account_menu_item_classes( $endpoint ) . '"><a href="' . esc_url( wc_get_account_endpoint_url( $endpoint ) ) . '"><span>' . esc_html( $label ) . '</span></a></li>';
            }
    
            $out .= '</ul>';
    
            return apply_filters('woodmart_override_heading_my_account_menu',$out);
        }
    }
    

    if they chose different hook other than woodmart_override_heading_my_account_menu let me know , i will update my plugin.

  5. woomatrix support repo owner

    Thanks i have also purchased that theme. i will take part in discussion if required.

  6. woomatrix support repo owner

    typical reply rather than permanent fix .

    you can copy paste below given code

    // **********************************************************************//
    // ! My account menu
    // **********************************************************************//
    
    
        function woodmart_get_my_account_menu() {
            $user_info  = get_userdata( get_current_user_id() );
            $user_roles = $user_info->roles;
    
            $out = '<ul class="wd-sub-menu' . woodmart_get_old_classes( ' sub-menu' ) . '">';
    
            foreach ( wc_get_account_menu_items() as $endpoint => $label ) {
                $out .= '<li class="' . wc_get_account_menu_item_classes( $endpoint ) . '"><a href="' . esc_url( wc_get_account_endpoint_url( $endpoint ) ) . '"><span>' . esc_html( $label ) . '</span></a></li>';
            }
    
            $out .= '</ul>';
    
            return apply_filters('woodmart_override_heading_my_account_menu',$out);
        }
    

    to your theme’s functions.php file. that will make it compatible with our plugin.

  7. Simon Gevcen | Jeriss Cloud Center ™ reporter

    Hello, you said you included the “override function within the plugin” but I don’t see it. Is it by default or is it a setting?

  8. woomatrix support repo owner

    It's not possible to override function from our plugin. It throws fatal error. So only option either have code snippet in child functions.php or wait for them to add any hook.

  9. Log in to comment