Creating custom WooCommerce endpoints
-
Hi,
Although on this page https://github.com/woocommerce/woocommerce/wiki/Customising-account-page-tabs#creating-new-endpoints it is recommended to use EP_ROOT | EP_PAGES, when creating custom endpoints, it raises some questions:
1. The above mentioned guide on github is from 2017 – is this still up to date?
2. Why is it handled differently in WooCommerce core? In class-wc-query.php (WooCommerce core) for the adding of the default endpoints a condition is used, to apply EP_ROOT only if it’s required (If endpoint should be used as front page).
3. Why is it handled differently in WooCommerce subscriptions core? Also WooCommerce subscriptions handles it not like described in the guide (Endpoint does not get applied to root, generally).
My theme (and I’ve also seen a few others) handles the creation of some custom endpoints following the example in the github guide, which then leads to some strange behavior when visiting the endpoint on the root.
Before getting in contact with the theme developers, I would like to know if adding the custom endpoints generally to the root directory is the recommended practice – which I can hardly believe?
- The topic ‘Creating custom WooCommerce endpoints’ is closed to new replies.