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

apply_filters('woocommerce_add_to_cart_quantity') is found 2 times:

  • /includes/class-wc-cart.php line 1042
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
        $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/ProductButton.php line 156
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    * @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' ),
        'tempQuantity'    => $number_of_items_in_cart,