woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
298 stars 110 forks source link

Adding price decimal adds white space before decimal point #14045

Closed rossanafmenezes closed 21 hours ago

rossanafmenezes commented 5 days ago

Describe the bug A clear and concise description of what the bug is. Please be as descriptive as possible; issues lacking detail, or for any other reason than to report a bug, may be closed without action.

Trying to add an amount to the price field is not working if you need to add decimal numbers. My store is in USD. I tried adding a Coupon Fix price discount (video attached). Tried a new order using the custom amount - this won't even let me add the . to add the cents. Tried editing an existing product.

To Reproduce Steps to reproduce the behavior in the video specifically:

  1. go to Menu
  2. Coupons
  3. add coupon
  4. Fixed cart discount
  5. try to add a price that has a decimal point

Screenshots If applicable, add screenshots to help explain your problem.

https://github.com/user-attachments/assets/8cf9fbb9-1f24-48df-b9b0-d95ee58dee5a

Isolating the problem (mark completed items with an [x]):

Mobile Environment Please include:

WordPress Environment

System Status Report ``` ### WordPress Environment ### WordPress address (URL): [Redacted] Site address (URL): [Redacted] WC Version: 9.3.2 Legacy REST API Package Version: The Legacy REST API plugin is not installed on this site. Action Scheduler Version: ✔ 3.8.1 Log Directory Writable: ✔ WP Version: 6.6.2 WP Multisite: – WP Memory Limit: 512 MB WP Debug Mode: ✔ WP Cron: ✔ Language: en_US External object cache: ✔ ### Server Environment ### Server Info: nginx PHP Version: 8.1.29 PHP Post Max Size: 2 GB PHP Time Limit: 1200 PHP Max Input Vars: 6144 cURL Version: 8.7.1 OpenSSL/1.1.1w SUHOSIN Installed: – MySQL Version: 10.6.18-MariaDB-log Max Upload Size: 2 GB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### [REDACTED] ### Post Type Counts ### attachment: 219 customize_changeset: 3 feedback: 4 jetpack_migration: 2 jp_img_sitemap: 7 jp_sitemap: 7 jp_sitemap_master: 7 mailpoet_page: 1 nav_menu_item: 10 page: 16 post: 2 product: 225 product_variation: 682 revision: 23 shop_coupon: 3 shop_order: 361 shop_order_refund: 16 shop_subscription: 7 wc_membership_plan: 1 wc_user_membership: 3 wp_global_styles: 3 wp_navigation: 2 wp_template: 3 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ ### Active Plugins (21) ### Akismet Anti-spam: Spam Protection: by Automattic - Anti-spam Team – 5.3.3 AutomateWoo: by WooCommerce – 6.0.19 Gutenberg: by Gutenberg Team – 19.2.0 Jetpack: by Automattic – 13.9-a.7 Layout Grid: by Automattic – 1.8.4 Page Optimize: by Automattic – 0.5.5 WooCommerce.com Update Manager: by Automattic – 1.0.3 WooCommerce Stripe Gateway: by WooCommerce – 8.7.0 Google Analytics for WooCommerce: by WooCommerce – 2.1.7 WooCommerce Memberships: by SkyVerge – 1.26.2 WooCommerce Payments Dev Tools: by Automattic – WooPayments: by WooCommerce – 8.2.2 WooCommerce Points and Rewards: by WooCommerce – 1.8.8 WooCommerce Product Add-Ons: by Woo – 7.1.0 WooCommerce Shipment Tracking: by WooCommerce – 2.4.6 WooCommerce UPS Shipping: by WooCommerce – 3.7.1 WooCommerce Stripe Dev Tools: by – WooCommerce Subscriptions: by WooCommerce – 6.4.1 WooCommerce: by Automattic – 9.3.2 WP Mail Logging: by WP Mail Logging Team – 1.12.0 WP Rollback: by WP Rollback – 2.0.7 ### Inactive Plugins (11) ### Advanced Shipment Tracking for WooCommerce: by zorem – 3.6.9 Loco Translate: by Tim Whitlock – 2.6.11 MailPoet: by MailPoet – 5.2.2 MailPoet Premium: by MailPoet – 4.42.0 WooCommerce Bookings: by WooCommerce – 2.1.0 WooCommerce Product Recommendations: by WooCommerce – 3.0.4 WooCommerce Product Search: by itthinx – 6.0.1 WooCommerce Smooth Generator: by Automattic – 1.1.0 WooCommerce Table Rate Shipping: by WooCommerce – 3.1.8 Woo Gift Cards: by Woo – 1.16.10 Woo Product Bundles: by Woo – 6.22.6 ### Dropin Plugins () ### advanced-cache.php: advanced-cache.php object-cache.php: Memcached ### Must Use Plugins (1) ### wpcomsh-loader.php: by – ### Settings ### Legacy API Enabled: – Force SSL: ✔ Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: booking (booking) bundle (bundle) external (external) grouped (grouped) simple (simple) subscription (subscription) variable (variable) variable subscription (variable-subscription) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: ✔ Enforce Approved Product Download Directories: ✔ HPOS feature enabled: ✔ Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore HPOS data sync enabled: ✔ ### Logging ### Enabled: ✔ Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2 Retention period: 30 days Level threshold: – Log directory size: 3 MB ### WC Pages ### Shop base: #7 - / Cart: #8 - /cart/ - Contains the [woocommerce_cart] shortcode Checkout: #9 - /checkout/ - Contains the woocommerce/checkout block My account: #10 - /my-account/ Terms and conditions: ❌ Page not set ### Theme ### Name: Homestore Version: 2.0.34 Author URL: https://woocommerce.com Child Theme: ✔ Parent Theme Name: Storefront Parent Theme Version: 4.6.0 Parent Theme Author URL: https://woocommerce.com/ WooCommerce Support: ✔ ### Templates ### Overrides: homestore/woocommerce/single-product/title.php ### WooPayments ### Version: 8.2.2 Connected to WPCOM: Yes WPCOM Blog ID: 221646855 Account ID: acct_1NXoNAC6ZmPjnrIw Payment Gateway: Enabled Test Mode: Enabled Enabled APMs: card,ideal WooPay: Enabled (product,cart,checkout) WooPay Incompatible Extensions: No Apple Pay / Google Pay: Enabled (product,cart,checkout) Fraud Protection Level: basic Multi-currency: Enabled Auth and Capture: Enabled Documents: Disabled Logging: Enabled ### Memberships ### Restriction mode:: Hide content only Public content:: Products: 1 item Excluded from discounts:: – Membership plans:: 1 Test Membership Plan:: Members: 3Access method: Product(s) purchaseAccess length: Specific length (1 months)Subscription: No ### Subscriptions ### WCS_DEBUG: ✔ No Subscriptions Mode: ✔ Live Subscriptions Live URL: https://testwoomobile.wpcomstaging.com Subscriptions-core Library Version: 7.2.0 Subscription Statuses: wc-active: 3 wc-cancelled: 1 wc-on-hold: 1 wc-pending: 2 WooCommerce Account Connected: ✔ Yes Active Product Key: ❌ No Report Cache Enabled: ✔ Yes Cache Update Failures: ✔ 0 failure ### Store Setup ### Country / State: United States (US) — California ### Subscriptions by Payment Gateway ### WooPayments: wc-active: 3 wc-on-hold: 1 ### Payment Gateway Support ### WooPayments: products refunds multiple_subscriptions subscription_cancellation subscription_payment_method_change_admin subscription_payment_method_change_customer subscription_payment_method_change subscription_reactivation subscription_suspension subscriptions subscription_amount_changes subscription_date_changes tokenization add_payment_method Cash on delivery: products WooPayments (iDEAL): products refunds multiple_subscriptions subscription_cancellation subscription_payment_method_change_admin subscription_payment_method_change_customer subscription_payment_method_change subscription_reactivation subscription_suspension subscriptions subscription_amount_changes subscription_date_changes tokenization add_payment_method ### Admin ### Enabled Features: activity-panels analytics product-block-editor coupons core-profiler customize-store customer-effort-score-tracks import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing mobile-app-banner navigation onboarding onboarding-tasks pattern-toolkit-full-composability product-custom-fields remote-inbox-notifications remote-free-extensions payment-gateway-suggestions printful shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page Disabled Features: experimental-blocks minified-js product-pre-publish-modal settings async-product-editor-category-field launch-your-store product-editor-template-system blueprint reactify-classic-payments-settings Daily Cron: ✔ Next scheduled: 2024-09-25 16:24:58 -04:00 Options: ✔ Notes: 123 Onboarding: completed ### Action Scheduler ### Canceled: 5 Oldest: 2024-09-07 07:47:06 -0400 Newest: 2024-09-23 14:02:46 -0400 Complete: 16,803 Oldest: 2024-08-25 12:18:26 -0400 Newest: 2024-09-25 10:33:30 -0400 Failed: 12,109 Oldest: 2023-07-25 12:35:35 -0400 Newest: 2024-09-25 08:58:04 -0400 Pending: 16 Oldest: 2024-09-25 10:35:29 -0400 Newest: 2024-10-21 11:55:52 -0400 ### Status report information ### Generated at: 2024-09-25 10:34:30 -04:00 ```
dangermattic commented 5 days ago

🚫 Please add a type label (e.g. type: enhancement) and a feature label (e.g. feature: stats) to this issue.

staskus commented 3 days ago

The issue is reproducible when the site has a decimal separator with a space after it.

image

PriceInputFormatter.format(input) method doesn’t expect such a decimal separator. It tries to be clever and replace spaces with decimal separators. Since the decimal separator by itself contains spaces we see the behavior of a number of spaces continuing to increase.