Support » Plugin: Quantity Field on Shop Page for WooCommerce » min=”1″ quantity

  • Resolved bdeserme

    (@bdeserme)


    Hello,

    Thanks for this plugin

    I need help to doing one modification.

    In my website i sell products by weight ( not by quantity )

    i install another plugin who allowed to me to decrease to 0,2 Kg of tomatoes on product page

    With Quantity Field on Shop Page i can’t decrease from 1 to 0,2 ..
    When i look with inspector of firefox i see that :

    <input type=”number” id=”quantity_5f4a71dc466ae” class=”input-text qty text” step=”0.2″ min=”1″ max=”10″ name=”quantity” value=”1″ title=”Qté” size=”4″ placeholder=”” inputmode=””>

    In which file i can change this min=”1″ value ?

    Thanks a lot

    SOrry if my english is not good enough

    Bastien
    Bordeaux / France

    • This topic was modified 1 month, 3 weeks ago by bdeserme.
    • This topic was modified 1 month, 3 weeks ago by bdeserme.

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

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author wooassist

    (@wooassist)

    @bdeserme you can try filtering the min qty of woocommerce

    function woocommerce_quantity_input_min_callback( $min, $product ) {
    	$min = 0.2;  
    	return $min;
    }
    add_filter( 'woocommerce_quantity_input_min', 'woocommerce_quantity_input_min_callback', 10, 2 );

    Hello,

    Thanks for your answer..

    I put this in my wc-quantity-field-shop-page.php file. But not working.

    Maybe at the wrong place ?

    You can see my website here : https://pourtapomme.com/bacasable/

    Thanks

    Bastien

    Plugin Author wooassist

    (@wooassist)

    @bdeserme you need to put that in your theme’s functions.php

    Hello,

    THanks, i try to put that in functions.php but not working.

    Maybe have you another idea ?

    THanks a lot

    Bastien

    Plugin Author wooassist

    (@wooassist)

    @bdeserme

    try adding this on the footer instead

    <script>
    	jQuery( document ).ready(function() {
        jQuery('input.qty').val('0.2');
    });
    </script>

    Hello

    When i put this on footer of functions.php i have this error :

    Error type E_PARSE, line 80 file /customers/e/3/7/pourtapomme.com/httpd.www/bacasable/wp-content/themes/storefront/functions.php. Error : syntax error, unexpected ‘

    When i put this on footer.php, my quantity is 0.2 by défault, but when i clicked it go to 1.0 and i can’t decrease,

    Thanks

    Bastien

    • This reply was modified 1 month, 3 weeks ago by bdeserme.
    Plugin Author wooassist

    (@wooassist)

    @bdeserme I thought you already have a plugin to decrease the quantity to 0.2?
    this is what you said on your first post

    i install another plugin who allowed to me to decrease to 0,2 Kg of tomatoes on product page

    Hello

    Yes i have “All in One Product Quantity for WooCommerce” but it work only on product page.

    I installed “Quantity Field on Shop Page for WooCommerce” to having the same on the shop page.

    Plugin Author wooassist

    (@wooassist)

    @bdeserme use this instead

    <script>
    	jQuery( document ).ready(function() {
        jQuery('input.qty').val('0.2');
    	jQuery('input.qty').attr('step', 0.2);
    });
    </script>

    Hello

    Thanks

    It’s works !

    Thanks a lot 🙂

    • This reply was modified 1 month, 2 weeks ago by bdeserme.
    Plugin Author wooassist

    (@wooassist)

    @bdeserme good to hear, thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.