woocommerce_add_to_cart_quantity

woocommerce_add_to_cart_quantity

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.5.1

apply_filters('woocommerce_add_to_cart_quantity') is found 2 times:

  • /includes/class-wc-cart.php line 1037
    				$product_id   = wp_get_post_parent_id( $variation_id );
    			}
    
    			$product_data = wc_get_product( $variation_id ? $variation_id : $product_id );
    			$quantity     = apply_filters( 'woocommerce_add_to_cart_quantity', $quantity, $product_id );
    
    			if ( $quantity <= 0 || ! $product_data || 'trash' === $product_data->get_status() ) {
    				return false;
    			}
    
    			if ( $product_data->is_type( 'variation' ) ) {
    
  • /src/Blocks/BlockTypes/ProductButton.php line 130
    			* @since 10.9.0
    			* @param number $default_quantity The default quantity.
    			* @param number $product_id The product id.
    			*/
    			$quantity_to_add = apply_filters( 'woocommerce_add_to_cart_quantity', $default_quantity, $product->get_id() );
    
    			$context = array(
    				'quantityToAdd'          => $quantity_to_add,
    				'productId'              => $product->get_id(),
    				'addToCartText'          => null !== $product->add_to_cart_text() ? $product->add_to_cart_text() : __( 'Add to cart', 'woocommerce' ),
    				'temporaryNumberOfItems' => $number_of_items_in_cart,