1. Casa
  2. Knowledge Base
  3. Modulo d'ordine all'ingrosso WooCommerce
  4. Stile di visualizzazione
  5. Come aggiungere un link per ordini all'ingrosso nella pagina del mio account
  1. Casa
  2. Knowledge Base
  3. Modulo d'ordine all'ingrosso WooCommerce
  4. Come aggiungere un link per ordini all'ingrosso nella pagina del mio account

Come aggiungere un link per ordini all'ingrosso nella pagina del mio account

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
Questo articolo è stato utile?

Articoli Correlati

Serve Supporto?

Non trovi la risposta che cerchi?
Contatta il Supporto
Completa il tuo acquisto