Your cart is currently empty!
Get the WooCommerce Shop URL (this is the root category page) with the following:
$shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );
My Account URL
You can get the WooCommerce My Account URL by using the woocommerce_myaccount_page_id option:
<?php if ( is_user_logged_in() ) { ?> <a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('My Account','woothemes'); ?>"><?php _e('My Account','woothemes'); ?></a> <?php } else { ?> <a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('Login / Register','woothemes'); ?>"><?php _e('Login / Register','woothemes'); ?></a> <?php } ?>
Or
$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' ); if ( $myaccount_page_id ) { $myaccount_page_url = get_permalink( $myaccount_page_id ); }
URL to WooCommerce Cartย Page
The WooCommerce Cart URL can be retrieved with a call to the cart objectโs get_cart_url() method:
global $woocommerce; $cart_url = $woocommerce->cart->get_cart_url();
URL to WooCommerceย Checkoutย Page
Similar to getting the cart URL, the WooCommerce Checkout URL can be retrieved with a call to the cart objectโs get_checkout_url() method:
global $woocommerce; $checkout_url = $woocommerce->cart->get_checkout_url();
URL to WooCommerceย Payment Page
This is the payment page URL used to collect payment information after the checkout page by redirect/hosted payment gateways. The path typically looks like /checkout/pay/. Get this URL with the following:
$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 );
URL to WooCommerceย Logoutย Page
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 ); }
Comments
-
Insertcart Custom WooCommerce Checkbox Ultimate
Original price was: $ 39.00.$ 19.00Current price is: $ 19.00. -
Android App for Your Website
Original price was: $ 49.00.$ 35.00Current price is: $ 35.00. -
Abnomize Pro
Original price was: $ 30.00.$ 24.00Current price is: $ 24.00. -
Medical Portfolio Pro
Original price was: $ 31.00.$ 24.00Current price is: $ 24.00. -
Your Website Set Up + Boost
Original price was: $ 49.00.$ 41.00Current price is: $ 41.00.
Latest Posts
- How to Use AWS SES Email from Localhost or Website: Complete Configuration in PHP
- How to Upload Images and PDFs in Android Apps Using Retrofit
- [Fix] File Permission Issue in Apache Website WordPress Not Writable to 775
- Best PHP ini Settings for WordPress & WooCommerce: Official Recommendations
- Script to Get Users System or Browser Data When Link Open Grab Using PHP & JavaScript
Leave a Reply