getdokan / dokan

Multivendor marketplace platform
https://wordpress.org/plugins/dokan-lite/
249 stars 191 forks source link

Issue with displaying the correct withdrawal charge amount on the vendor dashboard #2303

Open sazz-pranto opened 5 days ago

sazz-pranto commented 5 days ago

Bug Description

Description: If period (.) is selected as the thousand separator and prices are set to be displayed without any decimal point values in WooCommerce currency settings, it displays only the first digit of the withdrawal charge amount if the amount is more than three digits.

Step To Reproduce

  1. Go to WP admin dashboard > WooCommerce > Settings > General screen
  2. Set the currency options as described above
  3. Go to WP admin dashboard > Dokan > Settings > Withdraw Options screen and set a flat rate withdrawal charge for bank transfer as shown in this screenshot: https://snipboard.io/Fs8yA1.jpg
  4. Go to the vendor dashboard, proceed to make a withdrawal request, and observe the withdrawal charge.

Expected Behaviour

The correct withdrawal amount should appear regardless of the currency settings in WooCommerce.

Actual Behaviour

Please have a look at this video: https://d.pr/v/XuUKTJ

Additional Information

No response

Environment (please complete the following information)

1. Dokan Version: 3.11.3
2. WooCommerce Version: 9.0.2
3. WordPress version: 6.5.5
MdAsifHossainNadim commented 2 days ago

@sazz-pranto Brother, We discourage to use decimal precision as thousand separator. Because, in woocommerce accounting object we can't detect decimal precision as thousand seperator.

Screenshot 2024-07-04 at 10 03 37 AM Screenshot 2024-07-04 at 10 03 20 AM
J-H-Mojumder commented 18 hours ago

@MdAsifHossainNadim bhai As far as I can recall, there is a function that returns the decimal separator named wc_get_price_decimal_separator() that returns the value of the site's _options table's woocommerce_price_decimal_sep metakey's value. For the thousand separator, the function is wc_get_price_thousand_separator().

Am I missing anything?

MdAsifHossainNadim commented 18 hours ago

@J-H-Mojumder Brother, the problem is not only related to rendering. We are using WooCommerce account.formatMoney to receive the formatted money and then we are deducting the money from the receivable amount. Now, when we are using (.) separator as thousand separators then WooCommerce account.formatMoney cannot detect the correct thousand value due to decimal conflict. We therefore encourage not to use decimal separators as thousands or currency symbols via prohibition message on the relevant settings.

J-H-Mojumder commented 17 hours ago

@MdAsifHossainNadim bhai using (.) as a thousand separator is an accounting rule in many countries like Germany, Italy, Switzerland, Spain, France etc. If we have any limitations regarding this, we might need to change our approach towards the matter. Also, it is a default feature of WooCommerce. So, this will not look good to discourage users not to use this functionality.

I hope this will explain the scenario and the necessity of the matter.