woogc/get_checkout_url - WP Global Cart
documentation-template-default,single,single-documentation,postid-14556,theme-awake,eltd-core-1.1,woocommerce-no-js,awake child-child-ver-1.0.0,awake-ver-1.0,eltd-smooth-scroll,eltd-smooth-page-transitions,eltd-mimic-ajax,eltd-grid-1200,eltd-blog-installed,eltd-default-style,eltd-fade-push-text-top,eltd-header-standard,eltd-sticky-header-on-scroll-down-up,eltd-default-mobile-header,eltd-sticky-up-mobile-header,eltd-menu-item-first-level-bg-color,eltd-dropdown-slide-from-top,eltd-,eltd-fullscreen-search eltd-search-fade,eltd-side-menu-slide-from-right,wpb-js-composer js-comp-ver-6.3.0,vc_responsive


WP Global Cart / woogc/get_checkout_url
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on TumblrPin on PinterestEmail this to someonePrint this page


Name: woogc/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( 'woogc/get_checkout_url',     'WooGC_get_checkout_url');
    function  WooGC_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.

Would love your thoughts, please comment.x