I am building a theme and require the links to the log in / log out / register pages but don’t want the classic shortcode. I simply want the URL nothing else.
How are these urls called without the anchor tags?
Classic shortcode:
{% if shop.customer_accounts_enabled %}
{% if customer %}
<a href="/account">My Account</a>
{{ 'Log Out' | customer_logout_link }}
{% else %}
{{ 'Log In ' | customer_login_link }}
{{ 'Register' | customer_register_link }}
{% endif %}
{% endif %}
Required format:
{{ customer_logout_link_url }}
{{ customer_login_link_url }}
{{ customer_register_link_url }}
2
Answers
You can capture whatever is echoed as a link, then use that variable instead:
As far as I know, this isn’t possible. The docs don’t offer a way to do it.
Depending on why you want to do this, though, there is an alternative. This answer shows how you can add custom classes to the generated link, if that’s what you need to do. A simpler version of it looks like: