since WooCommerce 2.1 pages such as order-received has been removed and replaced with WC endpoints. My checkout page had a custom page template (page-checkout.php) and now all checkout endpoints are also using this custom page template.
I need to modify my header and footer only when my customers are in the /checkout/ page, but I want to show different content when they are in a checkout endpoints. I have found this conditional:
if(is_wc_endpoint_url("order-received")) echo "yes";
It works when we are in the "order-received" checkout endpoint. But I am looking for a conditional logic that tells me when we are not in an endpoint, something like:
if(!is_wc_endpoint()) echo "yes";
Thank you.
Endpoints are located at WooCommerce > Settings > Advanced.
Endpoints are the key to making sure that your WooCommerce store runs smoothly. They are the specific URL structures that handle all of the different aspects of your store, from adding products to the cart, to processing payments, and everything in between.
You can edit these endpoints by going to WooCommerce > Settings > Advanced > Endpoints. From here, you can add, remove, or change the slug for any of the default endpoints. Additionally, you can create new endpoints by clicking the “Add New Endpoint” button.
WooCommerce documentation says, “Endpoints are an extra part in the website URL that is detected to show different content when present.” In plainer language, WooCommerce endpoints are extra URL slugs for your WooCommerce URL slugs.
The questions seemed to be answered and bit old. But i found a better solution, which may help somebody else.
you can use the following function. Documentation
is_wc_endpoint_url()
if used without a parameter, it will check current url against all endpoints. If an endpoint is specified like
is_wc_endpoint_url('edit-account');
it will check either the url is of specific endpoint or not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With