Home Forums Basel support forum Adding a quantity button to the grid layout

Adding a quantity button to the grid layout

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #17599

    AllawiT
    Participant

    Hi there,
    How can I add a quantity button only in the grid layout?

    #17605

    Eric Watson
    Participant

    Hello,

    Try to add the following code snippet from article to the functions.php file in the child theme.

    https://docs.woocommerce.com/document/override-loop-template-and-show-quantities-next-to-add-to-cart-buttons/

    Kind Regards
    XTemos Studio

    #17615

    AllawiT
    Participant

    Thanks for the code it worked.
    The only downside that it goes to zero. Is there a way to limit this?

    Attachments:
    You must be logged in to view attached files.
    #17618

    AllawiT
    Participant

    That causes the whole theme to crash if you try to purchase with zero as the quantity.

    #17633

    Eric Watson
    Participant

    Hello,

    Try to add the following code snippet to the functions.php file in the child theme.

    add_filter( 'woocommerce_quantity_input_args', 'basel_woocommerce_quantity_input_args', 10, 2 );
    function basel_woocommerce_quantity_input_args( $args, $product ) {
    	$args['min_value'] 	= 1;   	// Minimum value
    	return $args;
    }
    

    Kind Regards
    XTemos Studio

Viewing 5 posts - 1 through 5 (of 5 total)