1. Home
  2. Knowledge Base
  3. WooCommerce Wholesale Order Form
  4. Display Style
  5. How To Add A Wholesale Ordering Link In My Account Page
  1. Home
  2. Knowledge Base
  3. WooCommerce Wholesale Order Form
  4. How To Add A Wholesale Ordering Link In My Account Page

How To Add A Wholesale Ordering Link In My Account Page

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
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support