WordPress filter hook
woocommerce_add_to_cart_sold_individually_found_in_cart
Defined by WooCommerce and fired by 6 plugins in total, running on 7M+ sites between them.
How to use woocommerce_add_to_cart_sold_individually_found_in_cart
It's a filter: your callback receives the value and 4 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'woocommerce_add_to_cart_sold_individually_found_in_cart', function( $value, $product_id, $variation_id, $cart_item_data, $cart_id ) {
// Change $value here.
return $value;
}, 10, 5 );Argument names come from AppPresser's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
6 plugins that fire woocommerce_add_to_cart_sold_individually_found_in_cart
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WooCommerce7+ million installs
apply_filters( 'woocommerce_add_to_cart_sold_individually_found_in_cart', $cart_item_key && $this->cart_contents[ $cart_item_key ]['quantity'] > 0, $product_id, $variation_id, $cart_item_data, $cart_id )includes/class-wc-cart.php:1358 -
MStore API2,000+ installs
apply_filters( 'woocommerce_add_to_cart_sold_individually_found_in_cart', $cart_item_key && WC()->cart->cart_contents[$cart_item_key]['quantity'] > 0, $product_id, $variation_id, $cart_item_data, $cart_id )controllers/flutter-woo.php:611 -
AppPresser900+ installs
apply_filters( 'woocommerce_add_to_cart_sold_individually_found_in_cart', $cart_item_key && $cart_contents[ $cart_item_key ]['quantity'] > 0, $product_id, $variation_id, $cart_item_data, $cart_id )modules/commerce/includes/api/v1/class-appcommerce-cart-controller.php:368 -
Food Online for WooCommerce300+ installs
apply_filters( 'woocommerce_add_to_cart_sold_individually_found_in_cart', $cart_item_key && WC()->cart->cart_contents[ $cart_item_key ]['quantity'] > 0, $product_id, $variation_id, $cart_item_data, $cart_id )classes/class-fdoe-ajax.php:508 -
Android and iOS App plugin for WooCommerce by WSD10+ installs
apply_filters( 'woocommerce_add_to_cart_sold_individually_found_in_cart', $cart_item_key && $cart_contents[ $cart_item_key ]['quantity'] > 0, $product_id, $variation_id, $cart_item_data, $cart_id )includes/api/class-wc-rest-cart-controller.php:305 -
Kiverniq Equipment Match for WooCommerceFewer than 10 installs
apply_filters( 'woocommerce_add_to_cart_sold_individually_found_in_cart', $found, (int) $i['product_id'], (int) $i['variation_id'], $cartData, $cartId )src/WooCommerce/Cart.php:177
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.