SaaS SEO
Find MRR with our SaaS-tellite technology
B2B & Enterprise SEO
Go boldly where no business has gone before
Wordpress SEO
Navigate the WordPress wormholes
Webflow SEO
Ride Webflow's cosmic currents
Shopify SEO
Parallel universe where your store makes money
AKOOL Launch Plans
Case Study: Building a Webflow SEO strategy
Yaasa's WooCommerce Dev & SEO
Case Study: How we broke through a Google penalty
Woocommerce Development
Woo-w your customers with a stellar storefront
Website Migration
Migrate your site to a more host-pitable planet
Casino M8trix Feature Dev & APIs
Case Study: How CasinoM8trix launched a new blackjack API & feature design
Wordpress Vs Webflow
Analysis: We review the choice between WordPress & Webflow
SEO Low Hanging Fruit Analysis
Guide: How we find and chase down SEO quick wins
Team
The galactic senate
Case Studies
Starship graveyard
UX Strategies for SEO
Analysis: What impact does UX have on your rankings?
SEO First Blog Design
Guide: Designing your blog for sales
Ethan's Shopify SEO
Case Study: How we grew a shopify site to 15k monthly visits in 6 months
Knowledge Base
A Hitchhiker's Guide to SEO
Blog
If you can find space for more reading
Why We Do Full Service SEO
Why implementation beats recommendations
Costs of Linkbuilding in 2024
Linkbuilding costs & tactics in 2024
Website Requirements Guidelines
How we stay on track
Knowledge Base > eCommerce > How to customize Woocommerce My Account Page?
Customizing the WooCommerce My Account page involves modifying the layout, adding custom fields, and adding custom functionality. Here are some ways to customize the WooCommerce My Account page, along with code samples:
To modify the layout of the WooCommerce My Account page, you can override the default templates by creating a new template file in your theme. Here’s an example of how to modify the “My Account” navigation links:
<?php /** * Override the My Account navigation links */ add_filter( ‘woocommerce_account_menu_items’, ‘custom_account_menu_items’ ); function custom_account_menu_items( $items ) { // Remove the “Dashboard” link unset( $items[‘dashboard’] ); // Add a new link $items[‘my-custom-link’] = __( ‘My Custom Link’, ‘textdomain’ ); // Return the modified items return $items; }
<?php /** * Override the My Account navigation links */
add_filter( ‘woocommerce_account_menu_items’, ‘custom_account_menu_items’ );
function custom_account_menu_items( $items ) { // Remove the “Dashboard” link unset( $items[‘dashboard’] );
// Add a new link $items[‘my-custom-link’] = __( ‘My Custom Link’, ‘textdomain’ );
// Return the modified items return $items; }
To add custom fields to the WooCommerce My Account page, you can use the woocommerce_edit_account_form action hook. Here’s an example of how to add a custom field for the user’s date of birth:
woocommerce_edit_account_form
<?php /** * Add a custom “Date of Birth” field to the “My Account” page */ add_action( ‘woocommerce_edit_account_form’, ‘custom_edit_account_form’ ); function custom_edit_account_form() { $user_id = get_current_user_id(); $dob = get_user_meta( $user_id, ‘date_of_birth’, true ); ?> <p class=”woocommerce-form-row woocommerce-form-row–wide form-row form-row-wide”> <label for=”date_of_birth”><?php _e( ‘Date of Birth’, ‘textdomain’ ); ?> <span class=”required”>*</span></label> <input type=”date” class=”woocommerce-Input woocommerce-Input–text input-text” name=”date_of_birth” id=”date_of_birth” value=”<?php echo esc_attr( $dob ); ?>” required> </p> <?php } add_action( ‘woocommerce_save_account_details’, ‘custom_save_account_details’ ); function custom_save_account_details( $user_id ) { if ( isset( $_POST[‘date_of_birth’] ) ) { update_user_meta( $user_id, ‘date_of_birth’, sanitize_text_field( $_POST[‘date_of_birth’] ) ); } }
<?php /** * Add a custom “Date of Birth” field to the “My Account” page */
add_action( ‘woocommerce_edit_account_form’, ‘custom_edit_account_form’ );
function custom_edit_account_form() { $user_id = get_current_user_id(); $dob = get_user_meta( $user_id, ‘date_of_birth’, true ); ?> <p class=”woocommerce-form-row woocommerce-form-row–wide form-row form-row-wide”> <label for=”date_of_birth”><?php _e( ‘Date of Birth’, ‘textdomain’ ); ?> <span class=”required”>*</span></label> <input type=”date” class=”woocommerce-Input woocommerce-Input–text input-text” name=”date_of_birth” id=”date_of_birth” value=”<?php echo esc_attr( $dob ); ?>” required> </p> <?php }
add_action( ‘woocommerce_save_account_details’, ‘custom_save_account_details’ );
function custom_save_account_details( $user_id ) { if ( isset( $_POST[‘date_of_birth’] ) ) { update_user_meta( $user_id, ‘date_of_birth’, sanitize_text_field( $_POST[‘date_of_birth’] ) ); } }
To add custom functionality to the WooCommerce My Account page, you can use the woocommerce_account_{endpoint}_endpoint action hook. Here’s an example of how to display the user’s order history on the “Orders” endpoint:
woocommerce_account_{endpoint}_endpoint
<?php /** * Display the user’s order history on the “Orders” endpoint */ add_action( ‘woocommerce_account_orders_endpoint’, ‘custom_account_orders’ ); function custom_account_orders() { $customer_orders = wc_get_orders( array( ‘customer_id’ => get_current_user_id(), ‘status’ => array( ‘wc-completed’ ) ) ); ?> <h2><?php _e( ‘Order History’, ‘textdomain’ ); ?></h2> <table class=”woocommerce-orders-table woocommerce-MyAccount-orders shop_table shop_table_responsive my_account_orders account-orders-table”> <thead> <tr> <th class=”woocommerce-orders-table__header woocommerce-orders-table__header-order-number”><?php _e( ‘Order’, ‘textdomain’ ); ?></th> <th class=”woocommerce-orders-table__header woocommerce-orders-table__header-order-date”><?php _e( ‘Date’, ‘textdomain’ ); ?></th> <th class=”woocommerce
<?php /** * Display the user’s order history on the “Orders” endpoint */
add_action( ‘woocommerce_account_orders_endpoint’, ‘custom_account_orders’ );
function custom_account_orders() { $customer_orders = wc_get_orders( array( ‘customer_id’ => get_current_user_id(), ‘status’ => array( ‘wc-completed’ ) ) ); ?> <h2><?php _e( ‘Order History’, ‘textdomain’ ); ?></h2> <table class=”woocommerce-orders-table woocommerce-MyAccount-orders shop_table shop_table_responsive my_account_orders account-orders-table”> <thead> <tr> <th class=”woocommerce-orders-table__header woocommerce-orders-table__header-order-number”><?php _e( ‘Order’, ‘textdomain’ ); ?></th> <th class=”woocommerce-orders-table__header woocommerce-orders-table__header-order-date”><?php _e( ‘Date’, ‘textdomain’ ); ?></th> <th class=”woocommerce
Useful Links:
No, you don’t need to have programming skills to use WooCommerce. However, basic knowledge of WordPress and some technical skills may be helpful in customizing your store.
Yes, you can use a different theme for your WooCommerce pages by creating custom template files in your child theme or using a plugin such as WooCommerce Theme Switcher. You can also use page builder plugins to create custom layouts for your WooCommerce pages.
You can customize the WooCommerce Order Received page by creating a custom template file in your theme or using a page builder plugin. You can also use WooCommerce hooks and filters to modify the layout, add custom fields, or change the behavior of the Order Received page.
You can customize the WooCommerce Thank You page by creating a custom template file in your theme or using a page builder plugin. You can also use WooCommerce hooks and filters to modify the layout, add custom fields, or change the behavior of the Thank You page.