WooCommerce important page url

Below there is some needed woo-commerce page URL, which is frequently used to develop any woo-commerce website.

The WooCommercer important page URL are

 

Shop Url

$shopUrl = get_permalink( woocommerce_get_page_id( ‘shop’ ) );

Cart Url

global $woocommerce;
$aUrl = $woocommerce->cart->get_cart_url();

 

Checkout Url

global $woocommerce;

$aUrl = $woocommerce->cart->get_checkout_url();

 

Account Url

$aAccountPageId = get_option( ‘woocommerce_myaccount_page_id’ );
$aUrl = get_permalink( $aAccountPageId );

 

Logout URL

This example will generate a WordPress logout URL that brings the user back to the Account area of the site:

$myaccount_page_id = get_option( ‘woocommerce_myaccount_page_id’ );

if ( $myaccount_page_id ) {

$logout_url = wp_logout_url( get_permalink( $myaccount_page_id ) );

if ( get_option( ‘woocommerce_force_ssl_checkout’ ) == ‘yes’ )
$logout_url = str_replace( ‘http:’, ‘https:’, $logout_url );
}

 

I hope that the woo-commerce page URL will help you in your development.

Share The Post On -