WPCommerce MultiDomain
woomd/get_checkout_url
Name: woomd/get_checkout_url
Type: Filter
Arguments: $checkout_url
The filter is being used to change the $checkout_url for specific shops. As default this is being controlled through admin settings but can be adjusted to particular shops if need.
The following code change the checkout url to shop default when blog_id is 4:
add_filter( 'woomd/get_checkout_url', 'WooMD_get_checkout_url'); function WooMD_get_checkout_url ( $checkout_url ) { global $blog_id; if( $blog_id == 4 ) { $_checkout_url = wc_get_page_permalink( 'checkout' ); if ( $_checkout_url ) { // Force SSL if needed if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) { $checkout_url = str_replace( 'http:', 'https:', $checkout_url ); } } } return $checkout_url; }
The code should be placed inside a php file on wp-content/mu-plugins folder or theme functions.php.
Quick question before buying :
Can we choose whether the redirection to the global checkout takes place at the level of the shopping cart or the payment page?
Hi,
Yes, you can use a conditional (e.g. url check ) to identify the current location and redirect accordingly to your requirements.
Thanks