Support » Plugin: ThemesZone WooCommerce Ajax Quantity » How to make the quantity box read only?

  • Hi!

    Thank you for this great plugin.

    I have adjusted it slightly, because I need to have min quantity and step defined. My only problem is, that the user can write any value inside the box neglecting the steps and it is added to cart.

    How can I make the quantity box read-only? Or to not accept any value that is not aligned with the step value?

    Looking forward for your answer!

    Thanks in advance
    Tamas

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter tom3r

    (@tom3r)

    It seems, I have found a way. I only need to add the class ‘readonly’ to the quantity box.

    On the other hand, I need to adjust the initial quantity that it adds, because the step for the product is 10 not 1. I found the public function custom_template_loop_add_to_cart where the ‘quantity’ => 1 is defined. Is there a way that you provide a filter hook for this variable so we can adjust the quantity based on website needs?

    Any help would be greatly appreciated!

    Thank you so much.

    Best wishes,
    Tamas

    Plugin Author themeszone

    (@themeszone)

    Hello Tamas

    Basically the QTY plugin respects values defined by user including MIN, MAX fields as well as STEP field (see image below)

    https://www.evernote.com/l/ACfoh69_XSZPALoc1bfZkLsKyZIw72BLxhk

    This means if you enable stock management for a product the QTY field will not go higher then stock defined value (given +/- icons are clicked). If user enters the value from keyboard the WooCommerce stock will show a warning that there are not enough items in the stock.

    If you want to use custom values try one of the plugins that do that, like the one below:

    https://wordpress.org/plugins/woo-min-max-quantity-step-control-single/

    if a step value is set QTY plugin will use the STEP value for increment.

    Hope that helps.

    Thread Starter tom3r

    (@tom3r)

    Hello

    Thank you for your answer. It seems that the min,max plugin is in conflict with my page and I cannot make it work. I’ve tried a workaround with your plugin that seems to work now, I posted it in another topic here: https://wordpress.org/support/topic/filter-for-minimum-quantity-added/

    What do you think about it?

    Looking forward for your reply.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to make the quantity box read only?’ is closed to new replies.