Month: August 2016

Change the WooCommerce continue shopping URL in WordPress

If you want to change the WooCommerce continue shopping URL in WordPress, then place the place the following snippet in functions.php file within your theme folder!.

The WooCommerce continue shopping button will use your shop archive to send customers back to the shop page. The following code will redirect to home page when you click continue shopping button in your cart page.

function change_continue_shopping_button_url() {
	return site_url();	
}
add_filter( 'woocommerce_continue_shopping_redirect', 'change_continue_shopping_button_url' );

Have any doubt, then comment here!

Change the WooCommerce Return to shop URL in WordPress

For our customization want to change the WooCommerce Return to shop URL in WordPress then place the place the following snippet in functions.php within your theme folder!.

The WooCommerce Return to Shop button will use your shop archive to send customers back to the shop when the cart is empty. The following code will redirect to home page when you click Return to shop button in your empty cart page.

function change_empty_cart_button_url() {
	return site_url();	
}
add_filter( 'woocommerce_return_to_shop_redirect', 'change_empty_cart_button_url' );

Have any doubt, then comment here!

Get WooCommerce cart page URL programmatically

For our customization want to get WooCommerce cart page URL programmatically then use the following snippet!. The WooCommerce cart page URL can be retrieved with a call to the cart object’s get_cart_url() function.

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

Have any doubt, then comment here!

Get woocommerce my account page URL programmatically

For our customization want to get woocommerce my account page URL programmatically then place the following snippet!. Here $myaccount_page_url returns the woocommerce my account page URL.

$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
if ( $myaccount_page_id ) {
  $myaccount_page_url = get_permalink( $myaccount_page_id );
}

Have any doubt, then comment here!

Get woocommerce payment page url programmatically

For our customization want to get woocommerce payment page url programmatically then place the following snippet!. Here the $payment_page having your woocommerce payment page url.

$payment_page = get_permalink( woocommerce_get_page_id( 'pay' ) );
if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' )
{ 
    $payment_page = str_replace( 'http:', 'https:', $payment_page );
}

Have any doubt, then comment here!

Get woocommerce logout page url programmatically

For our customization want to get woocommerce logout page url programmatically then place the following snippet!. Here $logout_url having your woocommerce 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 );
}

Have any doubt, then comment here!