Search
woogc/sync/on_post_vars - WP Global Cart
14409
documentation-template-default,single,single-documentation,postid-14409,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/sync/on_post_vars

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

woogc/sync/on_post_vars

Name: woogc/sync/on_post_vars
Type: Filter
Arguments: $PostVars

Filter being used to acknowledge the plugin engine to proceed with synchronization, usually following a custom AJAX call which is not being recognized as a WooCommerce default. (e.g. wc-ajax=add_to_cart,  wc-ajax=get_refreshed_fragments)

Certain plugins and themes use their own methods to handle the cart operations like add, remove.  To create a compatibility between such code and the WooCommerce Global Cart plugin, at least a POST parameter must be registered through the ‘woogc/sync/on_post_vars’ filter, recommended to be a unique field. The following sample code, inform the plugin engine to trigger a synchronization procedure right after a POST call has completed and included a field action => woocommerce_add_to_cart_variable_rc

Sample Usage

add_filter('woogc/sync/on_post_vars', 'woogc_sync_on_post_vars');
function woogc_sync_on_post_vars( $PostVars )
    {
        $PostVars[] = 'action=add_to_cart';
        $PostVars[] = 'action=woocommerce_add_to_cart_variable_rc';
        $PostVars[] = 'action=product_remove';

        return $PostVars ;
    }
0
Would love your thoughts, please comment.x
()
x