How to Get Various WooCommerce Page URLs

In an E-commerce site, we need Shop, Cart, Checkout & My Account, Logout and Payment page. So we install WooCommerce plugin, by default these plugins create all that pages but some point we want URL of this page for use in our WooCommerce plugins or themes. So what we do? Here is a solution. Here we find a solution to How to Get Various WooCommerce Page URLs.

Here, we are going to use one amongst the WooCommerce function wc_get_page_id(), which gives us the id of the given parameter. The parameter in this function is the name of the page, which will return the id. It will return -1 if no page is found.

We are also going to use one amongst the WordPress function get_permalink() which will give us the URL of the specified parameters. The parameter in this function is the id of the page, which will return the URL.

1. My Account

2. Shop

3. Payment

4. Cart

The WooCommerce Cart URL can be retrieved with a call to the cart object’s get_cart_url() method:

Another Option:

5. Checkout

WooCommerce Checkout URL can be retrieved with a call to the cart object’s get_checkout_url() method:

Another Option :

6. Logout

In this condition, we are going to check if your store has Force secure checkout setting enabled, which is found at the WooCommerce – Settings – Checkout tab. To add the “https:” protocol to your logout URL we have replaced the “http:” with “https:” which will make your logout URL secure.

I hope this post is useful and interesting. If you have any query related to WooCommerce than comment below. Our experienced WooCommerce developers are ready to solve your query.

 

I am definitely sure that after reading this article you learn How to Get Various WooCommerce Page URLs