woogc/get_cart_from_session/validate_hash
Name: woogc/get_cart_from_session/validate_hash
Type: Filter
Arguments: $force_validation, $values
When reconstructing the cart from session data, WooCommerce checks each of the products for validation. That includes existence, quantity, purchaseability, data hash. It happens, if a plugin implements a custom product type, if not active/available for a specific shop, the WooCommerce removes it from the cart. This is caused by a data hash that does not match anymore.
This filter can be used to force hash validity for specific products in the cart.
For example, if using the WooCommerce Bookings plugin on a shop, when checking the cart on other sites in the network, invalidates the item. To prevent that, while keeping the plugin active just on one site, the following code can be used:
add_filter ( 'woogc/get_cart_from_session/validate_hash', '__woogc_get_cart_from_session_validate_hash', 10, 2 );
function __woogc_get_cart_from_session_validate_hash( $force_validation, $values )
{
//check if the current product is a bookable product
if ( metadata_exists ( 'post', $values['product_id'], '_wc_booking_availability' ) )
$force_validation = TRUE;
return $force_validation;
}
The code should be placed inside a php file on wp-content/mu-plugins folder.
Related Posts
Name: woogc/checkout/single/split/trigger_email
Type: Filter
Arguments: $status, $args
By default,...
The capability to Split...
Splitting Orders, is a...
The Synchronization procedure is...
When running multiple Shops, a WordPress MultiSite environment is the optimal way to go. That provides a lot of interconnectivity possibilities, at an astonishing speed.
Our WooCommerce Global Cart plugin implements key features to make everything a robust, fast render and flexible marketplace.
The WooCommerce Product Synchronisation is a new powerful functionality recently introduced. This is designed to help with product synchronisation between multiple Shops in the network.
This newly implemented functionality helps with displaying WooCommerce Products across shops, in the network, under your WordPress MultiSite environment. Promote specific products, types of merchandise, category of goods, so boosting overall network sales. The new function is available as a Woocommerce Product Shortcode and is easy to implement. Any section of a site can include the shortcode to output the required products. The woocommerce shortcode is usable within the default WordPress editor ( classic ) or any advanced layout composer like Elementor, Divi, Visual Builder etc.
WooCommerce Tax area provides...
Name: woogc/get_cart_from_session/validate_hash
Type: Filter
Arguments: $force_validation, $values
When reconstructing...
Incredibly flexible, the WooCommerce...
On the Synchronization screen...