Skip to content

Instantly share code, notes, and snippets.

@themepaint
Created January 4, 2016 05:49
Show Gist options
  • Save themepaint/4c313db4bd9ca9a8fce9 to your computer and use it in GitHub Desktop.
Save themepaint/4c313db4bd9ca9a8fce9 to your computer and use it in GitHub Desktop.
Woocommerce Get URL some Functions.
//Shop Page URL
$shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );
//My Account URL
$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
if ( $myaccount_page_id ) {
$myaccount_page_url = get_permalink( $myaccount_page_id );
}
//Cart URL
global $woocommerce;
$cart_url = $woocommerce->cart->get_cart_url();
//Checkout URL
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url();
//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 );
//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 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment