Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Varun Sridharan

    (@varunms)

    @cyberfoxz

    What ever the price option allowed by WooCommerce Will work

    Hi Varun,

    I receive this message when trying to enter decimals (for example 90,50€ or 90.50€):

    “Please enter a valid value. The two nearest valid values are 90 and 91”.

    Then I have the arrows to go to up or down 1 unity.

    In FF and Chrome (which accepts a dot as a decimal separator, but not a comma, while FF accepts both) I have that message -in IE it defaults to 90€ directly-.

    In my WooCommerce configuration (WooCommerce > Settings > General) I have:

    – Decimal Separator: ,
    – Number of Decimals: 2

    Do you have any idea what can it be?
    Regards,

    Thread Starter cyberfoxz

    (@cyberfoxz)

    Hi Jan444,
    I had the same problem but i fixed is this way:

    file: woocommerce-quick-donation/template/fields/field-text.php
    add on top:

    str_replace(‘,’, ‘.’);

    In the input reaplce the type for :

    type=”number”
    step=”any”

    This worked for me, hope it also works for you!

    Hi Cyberfox, many thanks!

    I added step="any" to the html input, and it accepts decimals with a comma now (the desired behavior!).

    But what if people enter a dot “.”?
    Currently using FireFox it throws a message “please enter a valid number”, because it expects a comma as a separator.

    But is there a way the dot converts into a comma automatically, to make it easy for the people?

    I guess this snippet you mention is part of the solution: str_replace(',', '.');, but I don’t know where to paste it exactly.

    I guess within PHP tags at the top of the file, or maybe somewhere inside the html input itself?
    Could some javascript make this conversion ‘on the fly’ possible as well?

    Many thanks for any guidance.
    I’ll search by my side too and will report any advance.
    Cheers,

    Hi Guys,

    Thanks to all of you, my issue resolve…
    after making changes code in file: woocommerce-quick-donation/template/fields/field-text.php seems :

    <input step=”any”
    type=”number”
    id=”<?php echo $id; ?>”
    name=”<?php echo $name; ?>”
    class=”<?php echo $class.’ ‘.$attributes; ?>”
    value=”<?php echo $value; ?>” />

    and it works !!

    Hi @jan444 for your question – But what if people enter a dot “.”?
    we can manage this from woocommerce general settings:

    Decimal Separator — “,” or “.”

    Thanks Guys !!
    and thanks again Vaeun for a good plugin !!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to donate half euros??’ is closed to new replies.