Search
woogc/ps/interfaces/synchronize_to_sites - WP Global Cart
17124
documentation-template-default,single,single-documentation,postid-17124,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
 

woogc/ps/interfaces/synchronize_to_sites

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

woogc/ps/interfaces/synchronize_to_sites

Name: woogc/ps/interfaces/synchronize_to_sites
Type: Filter
Arguments: $sites

The filter allows you to regulate the shops that are accessible within the Synchronization Interface, determining where the feature is available.

The following example check if the edit page is for product ID 33 and 44. If match, it disable the synchronization option to the Shop ID 2:


   add_filter ( 'woogc/ps/interfaces/synchronize_to_sites', 'woogc_ps_interfaces_synchronize_to_sites' );
   function woogc_ps_interfaces_synchronize_to_sites( $sites )
        {
            
            global $post;
            
            if ( ! in_array ( $post->ID, array ( 33, 40 ) ) )
                return $sites;
                
            foreach ( $sites    as  $key    =>  $site )
                {
                    if ( $site->blog_id ==  '2' )
                        unset ( $sites[ $key ] );
                }
                
            return $sites;    
        }

The code should be placed inside a php file on wp-content/mu-plugins folder.

0
Would love your thoughts, please comment.x
()
x