Get Various WooCommerce Page URLs

/* ***********************
(1) Shop URL
**************************/

$shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );


/* ***********************
(2) My Account URL
**************************/
$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
if ( $myaccount_page_id ) {
$myaccount_page_url = get_permalink( $myaccount_page_id );
}


/* ***********************
(3 Cart URL
**************************/
global $woocommerce;
$cart_url = $woocommerce->cart->get_cart_url();



/* ***********************
(4) Checkout URL
**************************/
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url();



/* ***********************
(5) Payment Page URL
**************************/
$payment_page = get_permalink( woocommerce_get_page_id( 'pay' ) );

// make ssl if needed
if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) $payment_page = str_replace( 'http:', 'https:', $payment_page );


/* ***********************
(6) Logout URL
**************************/
$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 );
}




মন্তব্য

  • চমৎকার পোস্ট, ধন‍্যবাদ আপনাকে। আমিও কিছু যুক্ত করে দিবনে। :smile:
Sign In or Register to comment.