Ever wanted to display a my account page link in your WooCommerce theme files, and to have this changed to “Login / Register” in case your user is not logged in, dynamically?
Well the snippet below, when added into the relevant location in your theme template files will do just that!
We tend to wrap it in other controls, or include button links, but this makes a nice addition to header / footer links in a theme which is for WooCommerce to help users navigate to their My Account page(s).
Code above was just updated slightly. If you have questions or comments about this snippet, please leave them below. The aim, here, is to build a useful resource for WooCommerce developers around the globe.