• Hi!

    I have a problem with the quantity people can add. Earlier it was only possible to add a quantity that was equal to the maximum stock. But now they can add as much as they want to the cart (even if nothing of it shows up in the cart). I want the number to stop at our maximum stock.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter joelmellin

    (@joelmellin)

    Earlier the counter (that is marked with a red triangle in the attached picture) would automatically stop at the maximum stock when pushing the + button. But now it doesn’t.

    Picture 1

    It seems like this part of the code is not working anymore:

    function woa_woocommerce_quantity_input_args( $args, $product ) {
    if ( is_singular( ‘product’ ) && $product->is_type( ‘simple’ ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
    $args[‘input_value’] = 1; // Starting value (we only want to affect product pages, not cart)
    }
    $args[‘max_value’] = $product->get_stock_quantity; // Maximum value
    $args[‘min_value’] = 0; // Minimum value
    $args[‘step’] = 1; // Quantity steps
    return $args;
    }

    • This reply was modified 2 years, 10 months ago by joelmellin.
Viewing 1 replies (of 1 total)
  • The topic ‘Problem with quantity and stock’ is closed to new replies.