How To Add Wholesale Ordering link In My Account Page

Table Of Contents

    A common request we have had is how to display a wholesale ordering link on the My Account Page so that wholesale customers see a link to the WooCommerce Wholesale Order Form on the page they land on after they log in.

    By using the custom snippet below, you can now include an additional tab for the Wholesale Order Form on the My Account Page.

    Just simply edit the URL in the snippet to redirect your customers to your respective Wholesale Order Form URL.

    add_filter ( 'woocommerce_account_menu_items', 'wholesale_ordering_link' );
    function wholesale_ordering_link( $menu_links ){
     
      $new = array( 'wholesaleorderinglink' => 'Wholesale Ordering Form' );
     
      $menu_links = array_slice( $menu_links, 0, 1, true ) 
      + $new 
      + array_slice( $menu_links, 1, NULL, true );
     
      return $menu_links;
     
    }
     
    add_filter( 'woocommerce_get_endpoint_url', 'wholesale_ordering_hook_endpoint', 10, 4 );
    function wholesale_ordering_hook_endpoint( $url, $endpoint, $value, $permalink ){
     
      if( $endpoint === 'wholesaleorderinglink' ) {
     
        // here is the place for your custom wholesale ordering page URL
        $url = 'http://localhost/wholesale/wholesale-ordering/';
     
      }
      return $url;
     
    }

    You can add this custom snippet to your theme/child theme’s functions.php. Afterward, your My Account page should now display the Wholesale Order Form tab.

    Wholesale Order Form on My Account Page
    Wholesale Order Form on My Account Page
    in Display StyleWooCommerce Wholesale Order Form