• Resolved HelgaTheViking

    (@helgatheviking)


    Couple of issues that are all kind of related…

    Your override of quantity-input.php is not up to date. Core template supports a placeholder attribute, seen here:
    https://github.com/woocommerce/woocommerce/blob/master/templates/global/quantity-input.php#L44

    (It might also be helpful to have a @version tag in the doc header for easy comparison.

    Placeholders feature I use in my Mix and Match Products plugin…. to leave the inputs empty by default. But two things happen to a user who is using my plugin in conjunction with yours:

    The inputs don’t get the placeholder I’ve assigned them:
    https://share.getcloudapp.com/p9uPZEZz

    And in your script, an empty input is failing the isNaN() condition and returning early before it can trigger the .change() even that my plugin is listening for.

    You could patch this by changing
    var val = parseFloat(qty.val());

    to

    var val = "" !== qty.val() ? parseFloat(qty.val()) : 0;

    I hope you will take this into consideration.

    Cheers,
    -Kathy

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author taisho

    (@taisho)

    Hello Kathy,

    I’m sorry for the inconvenience and many thanks for helping me find and fix these issues. I already handled them in the development version that I will release in a couple of days. The NaN problem I approached differently, but the cause was as You mentioned returning early. The last 3 lines of code:

    qty.val( Math.round( qty.val() * 100 ) / 100 );
    qty.trigger("change");
    $( "body" ).removeClass( "sf-input-focused" );

    will now be executed for NaN as well.

    Best regards,

    Ryszard

    Thread Starter HelgaTheViking

    (@helgatheviking)

    Hi Ryszard! Thanks so much! I look forward to the new version which should resolve the issue between our plugins.

    Thread Starter HelgaTheViking

    (@helgatheviking)

    Hi @taisho,

    Any idea when the new version will be released? I just got another support ticket about this today.

    Is this plugin on github anywhere that I can send you a PR for the template? (if needed)

    cheers,
    -kathy

    Thread Starter HelgaTheViking

    (@helgatheviking)

    In the meantime, users of Mix and Match and Qty Increment buttons can use the following PHP snippet to set the default value to 0 to avoid an empty quantity box and avoid the issues with the JS calculation.

    
    /**
     * Default MNM quantity inputs to 0
     */
    add_filter( 'woocommerce_mnm_quantity_input', '__return_zero' );
    
    Plugin Author taisho

    (@taisho)

    I’m very sorry for the delay. Today I’ve released this new version.

    Thread Starter HelgaTheViking

    (@helgatheviking)

    Awesome work! The update is working great. Thanks so much!

    Hello!

    I used the out of date template and I cannot see the number. I’m a starter so I can’t really understand this solution. I checked the plugin but It’s really expensive. Can you tell me what to do or explain this something?

    Thanks guys!

    Thread Starter HelgaTheViking

    (@helgatheviking)

    Is this directed at me? If so, I do not understand the question. If you are using the Qty Increment plugin your template should be updated now.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘quantity-input.php template is out of date’ is closed to new replies.