Support » Plugin: Minimum Order Amount for Woocommerce » Minimum Amount with Comma Instead of Decimal

  • Resolved customle

    (@customle)


    The currency (USD) in the cart message is showing with commas instead of decimals. Here’s what it says now:

    A Minimum of $100,00 USD is required before checking out.
    Current cart’s total: $52,64 USD

    How do I change the comma to a decimal? It was working fine until just recently.

Viewing 12 replies - 1 through 12 (of 12 total)
  • buggfx

    (@buggfx)

    Here’s how I fixed this:

    Edit the plugin file “public/class-dc-moafw-public.php” and look on lines 134, 136, 149, 151, 165, and 177.

    On each of these lines you will see a function call similar to:
    number_format($minimum_cart_total, 2, ',', '.'),

    Remove the last two function arguments, for example:
    number_format($minimum_cart_total, 2),

    customle

    (@customle)

    Worked perfectly, thanks.

    Plugin Author dcurasi

    (@dcurasi)

    Hi,

    The change is correct.
    In the next version of the plugin I will add the possibility to choose whether to use the dot or comma.

    If you like the plugin, please give it a rating.

    Regards,
    dcurasi

    Thanks @buggfx, close but mistakes. @dcurasi’s lines were French notations. Error response would show the mimimal amount as the total as well. Instead this:

    Change lines 134, 149, 165 and 177 to:
    number_format($minimum_cart_total, 2, '.', ''),

    Change lines 136 and 151 to:
    number_format($total, 2, '.', ''),

    My only complaint is the USD dollar sign ($) currency symbol is being suppressed from the output string. Not absolutely essential, but not accurate without it. The plug needs to include the options to add the USD dollar sign ($) before the numerical amounts. Since WooCommerce -> Setting -> Currency includes 178 language options, it would be best to offer the option of a currency indicator in front of the currency amount or behind it. These are the only two possible locations. This would be a manually keyed in currency character defined by the user on the plugins setting page. Would be ideal option to add, @dcurasi.

    As a quick fix, I changed the above edits to echo the ($) sign, replacing with these lines instead:

    "\$" . number_format($minimum_cart_total, 2, '.', ''),
    And the second line:
    "\$" . number_format($total, 2, '.', ''),

    On the plugin’s configuration page, “Current cart’s total: [current]” is grammerically better stated “Total Currently in the Cart Including Tax: [current]”. A default I would change in the plugin’s next update.

    • This reply was modified 1 year, 11 months ago by Inndesign.
    • This reply was modified 1 year, 11 months ago by Inndesign.
    Plugin Author dcurasi

    (@dcurasi)

    Hi,

    Thanks @inndesign, i was already doing this.
    I hope to update the plugin within the next two weeks.

    If you like the plugin, please give it a rating.

    Regards,
    dcurasi

    Thanks, @dcurasi. Please, please add an option at the bottom of the plugin’s configuration page, to turn off the minimum notice on product pages. My client want’s it only displayed in the cart, not every product post. The red color minimum notice visually downgrades the layout too much to have the notice on every product page.

    Maybe also add option to change the hexadecimal color value of both the product page notice and a separate hexidecimal color value selection for the shopping cart? That would be exceptional, then the notice could be color edited to coordinate with the theme overall color scheme. The red box and text is simply too abrupt on the product pages, but just fine color on the cart page.

    On a different website using the same theme and plugins, the notice only appears in the cart but not above the products. Not sure what that is about but something is suppressing the notice above the product pages. It does not work consistently from site to site.

    Another bug note, if a person empties their cart completely after getting the minimum notice, the notice does not disappear. The cart refreshes but the notice remains. a detail that certainly needs fixed! The notice hangs in the cart, even if browser is closed and opened in new session with empty cart, despite the configuration notice that states, “(Note: the message will not be displayed if the cart is empty).”

    Overall, plugin does what it should! Will give it good rating 🙂

    Ahh yes @inndesign, you’re correct, I should have been more specific.

    I wasn’t suggesting to copy/paste my lines exactly, only to modify the function arguments as shown.

    Great plugin btw, works great!

    Plugin Author dcurasi

    (@dcurasi)

    Hi,

    i have updated the plugin.
    With this update the decimal and thousands separators, the currency position and the number of decimals in the price will be automatically set as in the Woocommerce settings.

    If you like the plugin, please give it a rating.

    Regards,
    dcurasi

    The edits are still not right, meaning I have to revert back to the older plugin version and edit myself. Your 1.40 update shows:

    A Minimum of USD50.00 is Required Before Checking Out.
    Total Currently in the Cart Including Tax: USD18.78

    As my WooCommerce is setup for the United States standard, it should read:

    A Minimum of $50.00 is Required Before Checking Out.
    Total Currently in the Cart Including Tax: $18.78

    If the cart is NOT setup for international use, WooCommerce never displays USD. Additionally, the dollar sign is still missing, which one of the bigger requests by users.

    • This reply was modified 1 year, 11 months ago by Inndesign.

    As a hard patch for version 1.40, to correctly display monetary values according to the United States standard, edit the plugin file “wp-content/plugins/minimum-order-amount-for-woocommerce/public/class-dc-moafw-public.php” and replace lines 137-140 and 152-155 with:

    " \$" . number_format($minimum_cart_total, $num_decimals, $decimal_separator, $thousand_separator),
    " " . $this->dc_moafw_get_currency_display_type($wcpbc_values),
    " \$" . number_format($total, $num_decimals, $decimal_separator, $thousand_separator),
    " " . $this->dc_moafw_get_currency_display_type($wcpbc_values) ),

    Then replace lines 168-169 and 180-181 with:

    " \$" . number_format($minimum_cart_total, $num_decimals, $decimal_separator, $thousand_separator),
    " " . $this->dc_moafw_get_currency_display_type($wcpbc_values) ),

    Even though the “USD” is still shown when it should not when WooCommerce is set to U.S. transactions only, the “USD” is now correctly behind the monetary value instead of in front, which was changed in the 1.40 update. Please note, these hard patches will be overwritten when the plugin is updated. These are basically hack edits for proper U.S. results.

    Additionally, with the WooCommerce snippet as a reference, which this plugin was founded (https://docs.woocommerce.com/document/minimum-order-amount/), the payment options are disabled when the minimum is not met. With the 1.40 update, the cart still allows payment even though the minimum has not been met, which basically negates the value of this plugin. Needs more work to generate correct results. Not right yet.

    • This reply was modified 1 year, 11 months ago by Inndesign.
    Plugin Author dcurasi

    (@dcurasi)

    Hi Steven,

    no patches are required.
    Simply set the “Currency Display Type” option to “Symbol” to display the $ symbol instead of USD.

    We have already discussed privately that the non-effectiveness of the plugin in the checkout is due to some conflict on YOUR SITE and that the same problem also occurs with the snippet provided by Woocommerce.
    Please, next time ask me before writing these things.
    I hope I can help you with yours as soon as possible.
    If you are patient, we can find a solution.

    I stand corrected, I did not see that new settings in the configurations panel. That does in fact solve the problem. Thanks for the update!

    No, the WooCommerce snippet works, it does block the payment type as it should. Your plugin does not on my client’s site. Reason I provided the four translations in exchange to get this fixed. Client is desperate to get that problem resolved.

    • This reply was modified 1 year, 11 months ago by Inndesign.
Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Minimum Amount with Comma Instead of Decimal’ is closed to new replies.