WooCommerce 2.1.X Endpoints vs Shortcodes
Since WC 2.1, some shortcodes in WooCommerce have been removed and replaced by endpoints. That means that some shortcodes aren’t valid anymore. Basically if you go to WooCommerce > Settings > Accounts tab, you will be able to view and edit endpoints values. Let’s say your “my account” page slug is “my-account”, then all pages will be reachable using this structure:
For the logout page it would be http://mysite.com/my-account/customer-logout
So, why did we choose to replace shortcodes by endpoints?
Well, WooCommerce is used by many non technical persons that can easily break it. In former WooCommerce versions, you had to create pages, create a link between those pages and WooCommerce settings, and add shortcodes to the newly created pages. That was too much, and too many risk to break the site. Now endpoints, give a really simple way to deal with custom urls and WooCommerce pages, without the risk of having a page without a shortcode that wouldn’t display anything.
How to add WooCommerce specific URLs to the WordPress menu
To add WooCommerce pages URLs to your WordPress main menu, simply go to Appearance > Menus in the WordPress main menu:
Then click on the links section:
And finally add custom URLs using the “my account” page slug and the endpoints values, and hit the add to menu button:
I don’t understand, doesn’t the Codex article you linked to say that the link then becomes: permalink/?foo=bar ?
That would mean that your example would show: http://mysite.com/?my-account=customer-logout
I’m sure it works, but how is that better than before?
And also from http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/#comment-686
“If pretty permalinks are not enabled then endpoints are not going to work. This is because endpoints rely on WordPress’s internal rewrite system which is disabled for the default links.”
that’s correct, but WooCommerce has some specific code that allows the use of custom permalinks structure.
[…] WooCommerce 2.1.X Endpoints vs Shortcodes by Rémi Corson […]
[…] WooCommerce 2.1.X Endpoints vs Shortcodes One of our support technicians Remi has explained the difference between WooCommerce 2.1 endpoints and how pages like pay, thanks and logout where handled in previous versions. […]
Firstly thanks for the article. But I am still confused.
The webpage http://develop.woothemes.com/woocommerce/2014/02/solving-common-issues-after-updating-to-woocommerce-2-1/ brought me here.
I upgraded from WooCommerce 2.0 to WooCommerce 2.1.2 and now some of my pages have stopped working. i.e. Change Password, Edit My Address. They were working in the previous version. What happening now is the [shortcodes] are being shown on the front end rather than the forms.
I read your article twice and I am still none the wiser. I tried blindly altering my permalinks to the default and then back again but it made no difference.
I don’t understand what I have to do to get these pages to work???
Can you please help???
Thanks very much.
Lord Liverpool, I can assist you here! I spent a long time scratching my head over this before I found this article.
If you head back to Remi’s article, from the point appearance, menus – you will need to set up a menu with custom links! I did this and have a user menu set in the top-menu area. Unfortunately I haven’t been able to get any login/register plugins to work with these endpoints (I tried 6 different plugins), but that may just be my lack of wordpress experience. However, for the most part the top menu is almost working as I expect – the /view-order endpoint is showing rather a lot more than the orders though, but I’m expecting to hear back from Woo any minute now..
… and those pages with the shortcodes in them are defunct – throw ’em in the trash :)
I used the shortcode to display the change and reset/lost password in a tab (one tab for change password and another tab for reset password). With the endpoints, how do I do that?
I just want to ask you about Woo-commerce. I want to take user input at the time of add product to cart as we are taking product id, quantity and resign to to purchase the product.
Waiting for your response.
hey, i’m sorry this is not related to the post ;-)
It’s okay Remi…
I agree that it is not related to post but as I go through your portal I found that you can give me solution of query so don’t you have the solution for this ?
How do we display a page via endpoints if not using the menu?
With shortcode we can make the shortcoded page as part of another page.
If can’t, I think there is still an advantage (to user) to have the shortcodes.
[…] you Remi Corson for this handy […]
Hi, what is now the conditional logic to know if we our current page is an endpoint? Is this working?
if(is_wc_endpoint_url(“order-received”)) echo “yes”;
you can use get_checkout_order_received_url()
If(get_checkout_order_received_url()==”order-received”) echo “yes”;
Why this function is better?
[…] you Remi Corson for this handy […]
thank you for the lovely post, it has help me resolve lot of issue after the update.
Couldyou please let me know how to get a page/link for change password.
I cant see any endpoint for change password .
All endpoints working except that the lost-password endpoint links to the same content as the view-order content.
Oh that is strange. Make sure you resave the permalinks structure.
Isnt it? not a 404 but to an existing page!
Yes they permalinks were the first thing i did. Also tried with all plugins off except for Woocommerce – still nada :(
Well fudge, the thing is WooCommerce endpoints don’t always work. In particular we have some serious ajax magic that enables loading of local content. Now we have to write special functions just to support this endpoint stuff.
I need my Thank You page to NOT be on HTTPS, so it can have an affiliate tracking “conversion pixel” which is called on a non-secure URL. But the ThankYou page is really just an EndPoint now — an alternate version of the Checkout page. So how can my Checkout page be HTTPS but my ThankYou page NOT be on HTTPS?
The product check out end point in settings shows order-received, but when the 404 error returns after a successful purchase, the bad url shows: “ordered-received”. When I take the “ed” out of the bad url and enter that, the problem is corrected, and it then comes up with the order status page, which is correct.
What I don’t know how to do is find the piece of code or setting that contains those extra letters. Can you please lead me to the place where I can go correct that syntax?
I was just wondering, I want to have an extra page for ‘recent orders’. Is this possible with a custom endpoint?
yes that’s possible using using the Endpoint API: http://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint
Thanks, i’ll look into it!
so do I have to add “/endpoint” to each page?
This Look like it’s working but I did not add the Endpoint: http://ancientafricanformula.com/check-out/
You can simply enable WooCommerce Endpoints menu items by activating it’s menu list from screen options instead of using custom links.