It is possible to create a link in the form of a tab within your built-in WooCommerce My Account page for web customers to access your bLoyal Web Snippets. We highly recommend that you use a readily available plugin to do so (link right below). However, you can also do that programmatically if you prefer.
Option 1 (Recommended): Use a WooCommerce Plugin to modify your My Account page
For ease-of-use and convenience we recommend that you go the plugin route. You may subscribe yearly at a low rate for the following plugin: Customize My Account for WooCommerce.
Option 2: Modify your My Account page programmatically
The following site also has general info for your web developer on how to accomplish this:
How to Customize 'My Account' Page in WooCommerce
Once you've selected the means of doing so (plugin vs. programmatically), here is how to point your customer account management tab at a bLoyal Account Management web snippet (the two key areas being in bold):
<?php
/**
*Plugin Name: bLoyal Account Management Tabs
*Plugin URI:
*Description: Embed bLoyal Account Management and Club Signup Snippets as tabs on the WooCommerce Account Management page.
*Version: 1.0.510.02
*/
ob_clean();
ob_start();
add_action( 'init', 'add_bloyal_endpoint' );
function add_bloyal_endpoint() {
add_rewrite_endpoint( 'loyalty-account', EP_ROOT | EP_PAGES );
}
add_filter( 'query_vars', 'custom_bloyal_query_vars', 0 );
function custom_bloyal_query_vars( $vars ) {
$vars[] = 'loyalty-account';
return $vars;
}
add_filter( 'woocommerce_account_menu_items', 'custom_add_loyalty_link_my_account', 20);
function custom_add_loyalty_link_my_account( $menu_links ) {
$bloyal_tab = array( 'loyalty-account' => 'Account Management');
$menu_links = array_slice( $menu_links, 0, 1, true ) + $bloyal_tab + array_slice( $menu_links, 1, NULL, true );
return $menu_links;
}
add_action( 'woocommerce_account_loyalty-account_endpoint', 'custom_bloyal_content' );
function custom_bloyal_content() {
echo do_shortcode('[bloyal_ACCTMGMT_WC]');
}
?>
The first item in bold refers to the name of your loyalty account tab which you may personalize, whereas the second item refers to the the shortcode of your selected bLoyal Account Management snippet, as set up in Director. You may look shortcodes up as described at the end of our bLoyal Plugin for WooCommerce: Update & Setup Guide. Once the PHP code is added, you may then go to Settings => Permalinks in WordPress and click Save. The new link will be added to the WooCommerce account management page.
Alternatively, you may also make a custom plugin by saving the above code (after personalizing it) as a PHP file in a directory called \embed-bloyal-tabs and name the file: embed-bloyal-tabs.php. Next, compress the directory along with the PHP file as a standard ZIP file and then upload it as a plugin to WordPress. We have the default form of this plugin available to download for your convenience:
Comments
0 comments
Article is closed for comments.