View Categories

Fix Price-by-Quantity Decimal & Separator Issues

Problem Description #

The plugin requires comma separators for quantities (or shows wrong decimals) and users in locales using comma as decimal separator see incorrect values.

Common symptoms:

  • The plugin returns an error or refuses a quantity when users type 1,5 (comma) vs 1.5 (dot).

  • Price calculations show incorrect decimal places.

Cause:
Different locales expect different decimal/thousands separators. The plugin may validate input using a specific format or not convert localized input to the expected canonical number format.

Solution – step-by-step #

  1. Check WordPress / WooCommerce locale settings

    1. Ensure Settings → General → Site Language and WooCommerce > Settings > General currency/location are correct for your locale. Some plugins respect WP locale.

  2. Test canonical format

    1. Try entering quantities with dot (1.5) and comma (1,5) to confirm which works. Use the plugin’s docs for guidance. WPFactory

  3. If plugin validates input, modify input before calculation (developer)

Add a small JS normalization function to replace commas with dots before sending values for calculation:

jQuery( document ).on(‘input’, ‘.quantity’, function(){

   var v = jQuery(this).val();

   jQuery(this).val( v.replace(‘,’, ‘.’) );

});

  1.  Important: Test carefully, this may alter UX expectations.

  1. Report to plugin author for locale support

    1. Ask the plugin to support locale-aware parsing or provide a setting to accept comma or dot. Provide examples and locale settings.

Prerequisites #

  • Ability to add small JS snippet to your theme or via custom JS.

  • Staging recommended if editing code.

Additional notes / prevention tips #

Document expected input format for users on product pages if immediate change is not possible.