Wednesday, 19 August 2020

Add Custom Woo Commerce My-Account Tab Page


// ------------------

// 1. Register new endpoint to use for My Account page

// Note: Resave Permalinks or it will give 404 error

  

function muhaza_add_extra_tab_endpoint() {

    add_rewrite_endpoint( 'extra-tab', EP_ROOT | EP_PAGES );

}

  

add_action( 'init', 'muhaza_add_extra_tab_endpoint' );

  

  

// ------------------

// 2. Add new query var

  

function muhaza_extra_tab_query_vars( $vars ) {

    $vars[] = 'extra-tab';

    return $vars;

}

  

add_filter( 'query_vars', 'muhaza_extra_tab_query_vars', 0 );

  

  

// ------------------

// 3. Insert the new endpoint into the My Account menu

  

function muhaza_add_extra_tab_link_my_account( $items ) {

    $items['extra-tab'] = 'Extra Tab';

    return $items;

}

  

add_filter( 'woocommerce_account_menu_items', 'muhaza_add_extra_tab_link_my_account' );

  

  

// ------------------

// 4. Add content to the new endpoint

  

function muhaza_extra_tab_content() {

echo '<h3>Premium WooCommerce Support</h3><p>Welcome to the WooCommerce support area. As a premium customer, you can submit a ticket should you have any WooCommerce issues with your website, snippets or customization. <i>Please contact your theme/plugin developer for theme/plugin-related support.</i></p>';

echo do_shortcode( ' /* your shortcode here */ ' );

}

  

add_action( 'woocommerce_account_extra-tab_endpoint', 'muhaza_extra_tab_content' );

// Note: add_action must follow 'woocommerce_account_{your-endpoint-slug}_endpoint' format

email mailto: pretext

 <a href="mailto:designoutsourced.com+info@gmail.com?subject=Maklumat%20lanjut%20pakej&body=Hai,%20saya%20berminat%20tahu%20lebi...