I was helped with a code snippet the other day to add an additional menu item inside the my account section of B2B (sales kit). I need to make this code snippet execute conditionally based on the group of the user (b2b Wholesale users only).
The code is below. Is this possible?
function b2bking_add_sales_kit_endpoint() { add_rewrite_endpoint( 'sales-kit', EP_ROOT | EP_PAGES ); }
I was helped with a code snippet the other day to add an additional menu item inside the my account section of B2B (sales kit). I need to make this code snippet execute conditionally based on the group of the user (b2b Wholesale users only).
The code is below. Is this possible?
function b2bking_add_sales_kit_endpoint() {
add_rewrite_endpoint( 'sales-kit', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'b2bking_add_sales_kit_endpoint' );
function b2bking_sales_kit_query_vars( $vars ) {
$vars[] = 'sales-kit';
return $vars;
}
add_filter( 'query_vars', 'b2bking_sales_kit_query_vars', 0 );
function b2bking_add_sales_kit_link_my_account( $items ) {
$i = 1;
$items = array_slice($items, 0, $i, true) +
array('sales-kit' => 'Sales Kit') +
array_slice($items, $i, count($items)-$i, true);
return $items;
Sales Kit}
add_filter( 'woocommerce_account_menu_items', 'b2bking_add_sales_kit_link_my_account' );
function b2bking_sales_kit_content() {
echo '
Click on the items below to retrieve your sales kit
'
;
}
add_action( 'woocommerce_account_sales-kit_endpoint', 'b2bking_sales_kit_content' );
Hi Jon,
I believe we discussed this earlier via Facebook Chat,
For future reference, developer documentation is found at https://woocommerce-b2b-plugin.com/docs/developer-documentation-hooks-functions-custom-code/
The following functions will be useful for this:
Kind regards,
Stefan