How to get WooCommerce page URLs in WooCommerce 3.x

Hey guyz! In this article we’ll learn how to get WooCommerce page URLs in WooCommercee 3.x. This is to easy to do. Read the article till the end and don’t forget to share with your Online store friends.

So without wasting any time let’s get start.

WooCommerce is an open-source e-commerce plugin for WordPress. It is designed for small to large-sized online merchants using WordPress. Launched on September 27, 2011, the plugin quickly became popular for its simplicity to install and customize and free base product. Read more about WooCommerce on Wikipedia.

WooCommerce is now the most popular eCommerce platform on the web (stats from Builtwith), so you can rest assured you’re in good company.

WooCommerce introduced a function which makes things much more elegant and simple, and gets rid of global $woocommerce and $aUrl when getting page URLs.

So, if you want to create a built-in custom menu for your theme or just need the WooCommerce pages URLs for other purposes, there’s a simple solution: the wc_get_page_id function.

The function can be used for getting the page URL for myaccount, Dashboard, edit_address, cart, shop, checkout, pay, view_order, and terms. It will return -1 if no page is found.

Examples of usage:

Get WooCommerce Page and display the My Account and other page URLs

<?php echo get_permalink( wc_get_page_id( 'PAGETITTLE' ) ); ?>

Now use this code to add all of your pages. Replace your Page Tittle with PAGETITTLE text.

This is how you can get WooCommerce page URLs in WooCommerce 3.x. I hope you understand. If you like this article please hit a like button on the top of the article and share with your friends, Who use WooCommerce for online store.

Read our best article on WordPress guide: Click Here.

If you have any issue please feel free to comment on this article. I’ll reply your comment as soon as possible. Thanks for reading this article.

Allah Hafiz.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *