• Home
  • WordPress Themes
    • eCommerce
    • Corporate
    • Multipurpose
    • Blog
  • Support
    • WoodMart support
    • Basel support
    • Space support
    • Feature requests
  • Documentation
    • WoodMart
    • Basel
    • Hitek, Luman, Antares
  • Demo
    • WoodMart
    • Basel
    • Hitek
Login / Register
Checkout
Checkout
Menu

Home / Forums / WoodMart support forum / Edit My Account Dashboard add new Endpoint

Home › Forums › WoodMart support forum › Edit My Account Dashboard add new Endpoint

Edit My Account Dashboard add new Endpoint

  • This topic has 7 replies, 3 voices, and was last updated 4 years, 4 months ago by Artem Temos.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • January 5, 2021 at 11:38 am #255868

    WebGuide
    Participant

    Hello,
    I would like to integrate YITH WooCommerce Affiliates into the “My Account” dashboard for customers.
    Unfortunately, the plugin “Woodmart Core” blocks editing the “function my_account_menu_order“.

    Why do I think this? The Woodmart theme offers the wishlist with it, this is also inserted there so this is probably handled somewhere else, can you tell me where? Or provide a solution?

    Here’s what I did.
    In \wp-content\themes\woodmart-child\functions.php I inserted this

    /**
    * Edit my account menu order
    */
    
    function my_account_menu_order() {
        $menuOrder = array(
           ‘dashboard’ => __( ‘Dashboard’, ‘woocommerce’ ),
           ‘orders’ => __( ‘Orders’, ‘woocommerce’ ),
           ‘downloads’ => __( ‘Download’, ‘woocommerce’ ),
           ‘edit-address’ => __( ‘Addresses’, ‘woocommerce’ ),
           ‘edit-account’ => __( ‘Account Details’, ‘woocommerce’ ),
           ‘customer-logout’ => __( ‘Logout’, ‘woocommerce’ ),
           ‘affiliate’ => __( ‘Affiliate Dashboard’, ‘woocommerce’ ),
      );
     return $menuOrder;
    }
    add_filter ( ‘woocommerce_account_menu_items’, ‘my_account_menu_order’ );
    
    /**
    * Register new endpoints to use inside My Account page.
    */
         add_action( ‘init’, ‘my_account_new_endpoints’ );
         function my_account_new_endpoints() {
         add_rewrite_endpoint( ‘affiliate’, EP_ROOT | EP_PAGES );
    }
    
    /**
    * Get new endpoint content
    */
    
    // affiliate
    add_action( ‘woocommerce_account_affiliate_endpoint’,
        ‘affiliate_endpoint_content’ );
        function affiliate_endpoint_content() {
     get_template_part(‘my-account-affiliate’);
    }
    

    Additionally I have created a my-account-affiliate.php under
    \wp-content\themes\woodmart-child\

    Can I write the following in my-account-affiliate.php afterwards? Instead of the HTML block, will the shortcode from YITH [yith_wcaf_affiliate_dashboard] work?

    <?php
    add_action( 'woocommerce_MyAccount_content', function(){
       echo do_shortcode( '[html_block id="9389"]' );
    }, 5 ); ?>

    For orientation I used this tutorial
    https://wptuts.co.uk/how-to-customize-woocommerce-dashboard-my-account-pages-more/
    it works for many themes, but not for Woodmart, because of Woodmart Core.

    You have already integrated YITH Compere & Wishlist so I think the other YITH are compatible.
    Thanks in advance for the support! I think this tip will help many.

    Best regards

    January 5, 2021 at 5:52 pm #255980

    Elise Noromit
    Member

    Hello,

    I will check with our dev theme if it is possible and get back to you.

    Best Regards

    January 6, 2021 at 9:16 am #256076

    Artem Temos
    Keymaster

    Hello,

    Please, add your code to some default theme (and child theme) on your website so we can see how it works first. Provide your admin access so we can then switch to our theme’s child theme and see the difference.

    Kind Regards

    January 6, 2021 at 12:01 pm #256139

    WebGuide
    Participant

    Hello,
    thank you for the quick response.
    Again to explain what I want to achieve with this measure. Attached is a screenshot.
    Point 1. there I want to extend the customer account menu with the tab “Affiliate”.
    Point 2. there the YITH WooCommerce Affiliates shortcode [yith_wcaf_affiliate_dashboard] should be displayed.

    I also want the wishlist to remain there. So I wonder if the code itself has a bug since the item „wishlist“ is missing there, so I changed it myself.
    New function my_account_menu_order code – everything else remains the same as in the first post above:

    function my_account_menu_order() {
        $menuOrder = array(
           ‘dashboard’ => __( ‘Dashboard’, ‘woocommerce’ ),
           ‘orders’ => __( ‘Orders’, ‘woocommerce’ ),
           ‘downloads’ => __( ‘Download’, ‘woocommerce’ ),
           ‘edit-address’ => __( ‘Addresses’, ‘woocommerce’ ),
           ‘edit-account’ => __( ‘Account Details’, ‘woocommerce’ ),
           ‘wishlist’ => __( ‘wishlist’, ‘woocommerce’ ),
           ‘affiliate’ => __( ‘Affiliate Dashboard’, ‘woocommerce’ ),
           ‘customer-logout’ => __( ‘Logout’, ‘woocommerce’ ),
      );
     return $menuOrder;
    }
    add_filter ( ‘woocommerce_account_menu_items’, ‘my_account_menu_order’ ); 

    Now I changed the functions.php and no matter if I change the functions.php in the main theme or in the child theme it always has a problem with line. 46 (In the main theme, of course, is a different line than 46 like in the child theme)

    Parse error: syntax error, unexpected 'Details’' (T_STRING), expecting ')' in /wp-content/themes/woodmart-child/functions.php on line 46

    Line 45     ‘edit-address’ => __( ‘Addresses’, ‘woocommerce’ ),
    Line 46     ‘edit-account’ => __( ‘Account Details’, ‘woocommerce’ ),
    Line 47      ‘wishlist’ => __( ‘wishlist’, ‘woocommerce’ ),

    When I delete line 46 edit-account I get the following error code:
    Parse error: syntax error, unexpected 'Dashboard'' (T_STRING), expecting ')' in /wp-content/themes/woodmart-child/functions.php on line 48
    So I delete line 48 affiliate and now I get to see the page for the first time again, no more error but warnings.

    Warning: Use of undefined constant ‘woocommerce_account_menu_items’ - assumed '‘woocommerce_account_menu_items’' (this will throw an Error in a future version of PHP) in /wp-content/themes/woodmart-child/functions.php on line 53
    
    Warning: Use of undefined constant ‘my_account_menu_order’ - assumed '‘my_account_menu_order’' (this will throw an Error in a future version of PHP) in /wp-content/themes/woodmart-child/functions.php on line 53
    
    Warning: Use of undefined constant ‘init’ - assumed '‘init’' (this will throw an Error in a future version of PHP) in /wp-content/themes/woodmart-child/functions.php on line 58
    
    Warning: Use of undefined constant ‘my_account_new_endpoints’ - assumed '‘my_account_new_endpoints’' (this will throw an Error in a future version of PHP) in /wp-content/themes/woodmart-child/functions.php on line 58
    
    Warning: Use of undefined constant ‘woocommerce_account_affiliate_endpoint’ - assumed '‘woocommerce_account_affiliate_endpoint’' (this will throw an Error in a future version of PHP) in /wp-content/themes/woodmart-child/functions.php on line 68
    
    Warning: Use of undefined constant ‘affiliate_endpoint_content’ - assumed '‘affiliate_endpoint_content’' (this will throw an Error in a future version of PHP) in /wp-content/themes/woodmart-child/functions.php on line 69
    
    Warning: Cannot modify header information - headers already sent by (output started at /wp-content/themes/woodmart-child/functions.php:53) in /wp-includes/functions.php on line 6360

    Access data in the Private Content area. (I have deleted the code again from the functions.php otherwise you can not log in)
    Thank you very much. I am curious.
    best regards

    Attachments:
    You must be logged in to view attached files.
    January 6, 2021 at 12:05 pm #256142

    Artem Temos
    Keymaster

    Could you please do this with a default theme so we can see how it should work? We will then switch to our theme and test again.

    January 6, 2021 at 12:53 pm #256160

    WebGuide
    Participant

    ok wait.

    January 6, 2021 at 3:20 pm #256201

    WebGuide
    Participant

    Now it works, I made a mistake.
    I have swapped ‘ with ‘.

    Here is the code for the community
    functions.php

    /**
    * Edit my account menu order
    */
     function my_account_menu_order() {
     	$menuOrder = array(
    		'dashboard'          => __( 'Dashboard', 'woocommerce' ),
     		'orders'             => __( 'Orders', 'woocommerce' ),
     		'downloads'          => __( 'Download', 'woocommerce' ),
     		'edit-address'       => __( 'Addresses', 'woocommerce' ),
     		'edit-account'    	=> __( 'Account Details', 'woocommerce' ),
     		'wishlist'    		=> __( 'Wishlist', 'woocommerce' ),
    		'affiliate'          => __( 'Affiliate Dashboard', 'woocommerce' ),
    		'customer-logout'    => __( 'Logout', 'woocommerce' )
     	);
     	return $menuOrder;
     }
     add_filter ( 'woocommerce_account_menu_items', 'my_account_menu_order' );
     
     /**
      * Register new endpoints to use inside My Account page.
      */
    
     add_action( 'init', 'my_account_new_endpoints' );
    
     function my_account_new_endpoints() {
     	add_rewrite_endpoint( 'affiliate', EP_ROOT | EP_PAGES );
     }
     /**
      * Get new endpoint content
      */
    
      // affiliate
     add_action( 'woocommerce_account_affiliate_endpoint', 'affiliate_endpoint_content' );
     function affiliate_endpoint_content() {
         get_template_part('my-account-affiliate');
     }

    my-account-affiliate.php
    <?php echo do_shortcode("[yith_wcaf_affiliate_dashboard]"); ?>

    January 6, 2021 at 3:21 pm #256203

    Artem Temos
    Keymaster

    Great, we are glad that you have sorted it out!

  • Author
    Posts

Tagged: Edit My Account Page Dashboard Affiliate Child Theme Funktion.php Edit My Account Dashboard add new Endpoint

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Edit My Account Dashboard add new Endpoint’ is closed to new replies.

  • You must be logged in to create new topics. Login / Register

Your request can't be resolved for a long time? Contact our general support manager.

Contact form
WoodMart Facebook Group
Create your WordPress website.
  • Resources
    • Video tutorials
    • Blog
    • Contact us
    • Refund Policy
    • Terms of Service
  • Social links
    • Facebook
    • Twitter
    • Instagram
    • YouTube
@ XTemos studio. 2025 WordPress development from 2015.

Privacy Policy

  • Home
  • WordPress Themes
    • eCommerce
    • Corporate
    • Multipurpose
    • Blog
  • Support
    • WoodMart support
    • Basel support
    • Space support
    • Feature requests
  • Documentation
    • WoodMart
    • Basel
    • Hitek, Luman, Antares
  • Demo
    • WoodMart
    • Basel
    • Hitek
  • Login / Register
Sign in
Close

Lost your password?

No account yet?

Create an Account