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
By default, on Product...
Name: woogc/ps/synchronize_product/child_product
Type: Filter
Arguments:
(object)$child_product
(array)$main_product_data
(int)$origin_product_blog_ID
This filter...
The WooCommerce Global Cart...
The Global Cart feature...
In the ever-evolving landscape of e-commerce, where seamless customer experiences are the cornerstone of success, WooCommerce Global Cart is now supporting the new WooCommerce Cart Blocks and Checkout Blocks, as powerful allies for merchants seeking to elevate their checkout processes. This groundbreaking integration seamlessly blends the benefits of Global Cart with the enhanced functionality of the new blocks, propelling businesses towards a paradigm shift in their online shopping journeys. Starting WooCommerce version 8.3 the Cart Blocks and Checkout Blocks are now the default checkout flow for new installations.
Name: woogc/ps/interfaces/sync_to_shop
Type: Filter
Arguments: $status, $remote_blog_id, $post
The...
Name: woogc/ps/synchronize_product/completed
Type: Filter
Arguments: $child_product_ID, $main_product_ID,...
Name: woogc/ps/interfaces/synchronize_to_sites
Type: Filter
Arguments: $sites
The filter...
When utilizing the Single...
WPGlobalCart is a powerful WooCommerce plugin designed to streamline e-commerce operations within a WordPress MultiSite network. It offers a range of tools and features that simplify product management, making it an essential tool for businesses with multiple online stores.
Product Synchronization Made Easy
One of the standout features of the WPGlobalCart plugin is its user-friendly and efficient approach to product synchronization. Managing a diverse range of products across multiple websites within a WordPress MultiSite network can be a complex and time-consuming task. However, WPGlobalCart streamlines this process, offering a set of tools and features that make product synchronization a breeze.