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

If your wholesale customers land on the My Account page after logging in, you can add a direct link to your order form as a new tab so they reach it in one click. The snippet below uses two standard WooCommerce filters to register a custom menu item and point it to your WooCommerce Wholesale Order Form page.

Prerequisites

  1. Copy the snippet below.
  2. Update the URL on the marked line to match your wholesale order form page address.
  3. Add the snippet to your child theme’s functions.php file or paste it into a code snippets plugin such as WPCode.
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' ) {
 
    // Replace this URL with your wholesale order form page address
    $url = 'https://example.com/wholesale-ordering/';
 
  }
  return $url;
 
}

After saving, your My Account page will display a new Wholesale Ordering Form tab for all logged-in users. You can confirm it is working by logging in as a wholesale customer.

Wholesale Order Form tab on the My Account page
Wholesale Order Form tab on the My Account page

Need help?

If you have a question or run into any issues, we’re here to help.

Was this article helpful?

Related Articles

Need Support?

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