woomd/sync/on_post_vars
Name: woomd/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 ‘woomd/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('woomd/sync/on_post_vars', 'woomd_sync_on_post_vars'); function woomd_sync_on_post_vars( $PostVars ) { $PostVars[] = 'action=add_to_cart'; $PostVars[] = 'action=woocommerce_add_to_cart_variable_rc'; $PostVars[] = 'action=product_remove'; return $PostVars ; }