This week’s WooCommerce function is about endpoints. What’s an endpoint? Endpoints are “an extra part in the website URL that is detected to show different content when it’s present. For example: You may have a ‘My Account’ page shown at yoursite.com/my-account. When the endpoint ‘edit-account’ is appended to this URL, making it ‘yoursite.com/my-account/edit-account‘ then the Edit Account page is shown instead of the My Account page.” (Source: WooCommerce).
There are dozens of WooCommerce endpoints, especially for the Checkout and My Account page, as well as custom endpoints added by third-party WooCommerce plugins. It’s difficult to remember all the different URLs, so here comes wc_get_endpoint_url
to the rescue.
As usual, in this article, we’ll study the WooCommerce core function code for wc_get_endpoint_url
in this tutorial, see where and why it’s used, and finally, we’ll look at a brief case study. Enjoy!