Decimal Separator

Home Forums Ticket Products Event Tickets Plus Decimal Separator

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1138534
    Martin
    Participant

    Hi there,

    this is not a bug, but a need:

    I am running woo commerce and events tickets (plus) on a German website. In Germany the Decimal Separator is a “,” instead of a “.”

    I have the right settings in Woocommerce, but with event tickets it doesn’t work. Event tickets only accepts the “.”

    Is there a way to change that?

    Thank you for getting back to me!

    Regards

    #1138927
    Nico
    Member

    Hi Martin,

    Thanks for reaching out to us! I’ll help you here…

    As far as I could test our plugin is following what’s defined in WooCommerce settings (at least in the tickets form). Can you please send me a screenshot of the price without the Woo format? I’ll re-check on that location to see if I can reproduce this locally.

    Thanks,
    Nico

    #1139046
    Martin
    Participant

    Hi Nico,

    thank you for getting back to me. I am not exactly sure what screenshots you would like to see. So I have added 5. The first one is the settings for currency at woocommerce.

    The second and the third one show what happens when I use a “.” in event tickets plus (this is: the “.” will be used on the frontage.

    The fourth and the fifth one show what happens, when I use the “,”. On the fronted you will not see a price at all …

    I hope this helps

    #1139051
    Martin
    Participant

    Looks like the uploads did#t work… so here once again files 1 – 4

    #1139053
    Martin
    Participant

    and here is screenshot No. 5

    #1139326
    Nico
    Member

    Hey Martin,

    Thanks for following up! I get you know! It’s like the field is only accepting ‘.’ for decimals and not ‘,’. And in the cases where there’s a decimal part the in the price is showing as a ‘.’ in the front-end. This seems to be a bug in our code.

    Paste the snippet below in your theme’s (or child theme’s) functions.php file, it should make it right for now:

    /* Force comma as decima separator for event cost */
    function tribe_convert_decimal_char ( $cost, $post_id, $with_currency_symbol ) {

    return str_replace ( '.' , ',' , $cost );
    }

    add_filter( 'tribe_get_cost', 'tribe_convert_decimal_char', 10, 3 );

    Also, next maintenance release 4.2.3 is coming out next week with various tweaks for tickets including some changes in how the price field is managed. I’m not sure if this is going to be fixed as there’s no actual tickets that refer to this particular glitch, but maybe the changes introduced makes this right or behave in a different way.

    Please let me know if the snippet makes it right for now and in that case if you can wait till 4.2.3 is out to re-check this,
    Best,
    Nico

    #1139353
    Martin
    Participant

    Hi Nico,

    thank you for the effort you put into this. It now works in this way: when I enter a price in event tickets using the “.” as a separator it will show up as a “,” in the front-end. So thank you very much for this.

    While we are on this note I foo have a question and we don’t have to go there, but …

    Over here it is quite common to write: € 30,-
    This means 30,00 or like in the US it would probably be 30.00

    Is there a way to make that possible as well? Maybe you want to ad that to the changes for the next release or the one after that? Or maybe there is even a way to tweak it right now?

    Just asking …

    Again, thank you very much and have a great evening – at least we have it evening here right now …

    Regards

    #1139927
    Nico
    Member

    Thanks for following up Martin! Glad to hear we are getting close to have this as you need 🙂

    Indeed the snippet is for the front-end display but you still need to input the price in the ‘10.50’ format in the back-end.

    Over here it is quite common to write: € 30,-

    No problem, let’s look into making the snippet more complete:

    /* Custom format for event cost */
    function tribe_custom_cost_fomat ( $cost, $post_id, $with_currency_symbol ) {

    if( $cost == '' || $cost == 'Free' || $cost == 'Eintritt frei' ) return $cost;

    $cost = str_replace ( '.' , ',' , $cost );
    $cost .= ',-';

    return $cost;
    }

    add_filter( 'tribe_get_cost', 'tribe_custom_cost_fomat', 10, 3 );

    Please update the snippet and let me know if it works as expected,
    Best,
    Nico

    #1139937
    Martin
    Participant

    Hi Nico,

    thumbs up – works perfect. Do I need to watch it when the update comes to make sure the update doesn’t change anything here?

    Anyways, thank you for your help – makes using the plugin even more pleasant …

    Best regards!

    Martin

    #1140041
    Nico
    Member

    Stocked to hear Martin! Thanks for the kind words 🙂

    Do I need to watch it when the update comes to make sure the update doesn’t change anything here?

    Plugin updates shouldn’t make this customization go south (be sure to check it once in a while though), but if you are not using a child theme and the theme receives an update then it might override the functions.php file and the snippet will be wiped out. You can create a child theme to address this or use a plugin like Code Snippets to store snippets.

    I’ll log this bug but I’m not sure when it will be fixed so stay tuned to our upcoming release notes! I’m closing out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.

    Have a great weekend,
    Nico

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Decimal Separator’ is closed to new replies.