Add “My Quotes” menu to WooCommerce My Account Menu
-
Good day,
Just thought I would share. This code will add a new menu item called “My Quotes” to the WooCommerce My Account Menu and add all the saved quotes to the this new tab. It will also remove the saved quotes from the dashboard tab.
Just copy and paste into your theme’s functions.php file.
/* * Step 1. Add "My Quotes" Link (Tab) to My Account menu */ add_filter ( 'woocommerce_account_menu_items', 'my_quotes_link', 40 ); function my_quotes_link( $menu_links ){ $menu_links = array_slice( $menu_links, 0, 2, true ) + array( 'my-quotes' => 'My Quotes' ) + array_slice( $menu_links, 2, NULL, true ); return $menu_links; } /* * Step 2. Register Permalink Endpoint */ add_action( 'init', 'quotes_add_endpoint' ); function quotes_add_endpoint() { add_rewrite_endpoint( 'my-quotes', EP_PAGES ); } /* * Step 3. Content for the new "My Quotes" tab */ add_action( 'woocommerce_account_my-quotes_endpoint', 'my_quotes_my_account_endpoint_content' ); function my_quotes_my_account_endpoint_content() { //show saved quotes watq_show_saved_quotes(); } /* * Step 4. Save Permalink Settings (Go to Settings > Permalinks and just push "Save Changes" button.) */ /* * Step 5. Remove saved quotes from my account dashboard tab */ remove_action('woocommerce_before_my_account', 'watq_show_saved_quotes');
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add “My Quotes” menu to WooCommerce My Account Menu’ is closed to new replies.