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.9.5

apply_filters('woocommerce_add_to_cart_quantity') is found 3 times:

  • /includes/class-wc-cart.php line 1060
    				$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 || ProductStatus::TRASH === $product_data->get_status() ) {
    				return false;
    			}
    
    			// Variable product cannot be added to cart without a specified variation.
    
  • /src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php line 167
    			 * @since 10.9.0
    			 * @param number $default_quantity The default quantity.
    			 * @param number $product_id The product id.
    			 */
    			$default_quantity = apply_filters( 'woocommerce_add_to_cart_quantity', 1, $product->get_id() );
    
    			$context = array(
    				'productId'   => $product->get_id(),
    				'productType' => $product->get_type(),
    				'quantity'    => $default_quantity,
    			);
    
  • /src/Blocks/BlockTypes/ProductButton.php line 157
    			 * @since 10.9.0
    			 * @param number $default_quantity The default quantity.
    			 * @param number $product_id The product id.
    			 */
    			$default_quantity = apply_filters( 'woocommerce_add_to_cart_quantity', $default_quantity, $product->get_id() );
    		}
    
    		$add_to_cart_text = null !== $product->add_to_cart_text() ? $product->add_to_cart_text() : __( 'Add to cart', 'woocommerce' );
    
    		if ( $is_descendent_of_add_to_cart_form && null !== $product->single_add_to_cart_text() ) {
    			$add_to_cart_text = $product->single_add_to_cart_text();