woocommerce / woocommerce-ios

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

[Order form] Setting a new tax rate doesn't recalculate a base tax-inclusive product price #13342

Closed staskus closed 1 month ago

staskus commented 1 month ago

Describe the bug

When Prices entered with tax: Yes, I will enter prices inclusive of tax is enabled, then according to documentation:

If you select Yes, I will enter prices inclusive of tax, you would enter £9.99 as the total product price. WooCommere will work backwards from that total and calculate that it includes the base product price of £8.325 and the tax of £1.665 to display, automatically rounded.

However, when a new tax rate is set through "Set New Tax Rate", tax is applied on a previously applied base product price, making Order total higher, than the product price inclusive of tax.

To Reproduce Steps to reproduce the behavior:

  1. Set Prices entered with tax: Yes, I will enter prices inclusive of tax (WooCommerce -> Settings -> Tax)
  2. Set at least two tax rates, one with a concrete country code that will appear in "Set New Tax Rate" view on the app (WooCommerce -> Settings -> Tax -> Standard Rates)
  3. Go to the app, Orders
  4. Tap "+" to add Order
  5. Add a new product
  6. Confirm that the order total is equal to the product price you entered when creating a product
  7. Tap "Set New Tax Rate"
  8. Select a different tax rate
  9. Confirm that the order total is now different from the product price you entered when creating a product

Screenshots

https://github.com/user-attachments/assets/a236c177-93a5-4370-826b-9ef28b41e3b0

Expected behavior

Base price should be recalculated after setting a new tax rate.

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

Mobile Environment Please include:

WordPress Environment

``` ` ### WordPress Environment ### WordPress address (URL): https://testpovilasstore.mystagingwebsite.com Site address (URL): https://testpovilasstore.mystagingwebsite.com WC Version: 9.1.1 Legacy REST API Package Version: The Legacy REST API plugin is not installed on this site. Action Scheduler Version: ✔ 3.7.4 Log Directory Writable: ✔ WP Version: 6.5.5 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.2.21 PHP Post Max Size: 2 GB PHP Time Limit: 1200 PHP Max Input Vars: 6144 cURL Version: 8.7.1 OpenSSL/3.0.13 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 ### WC Database Version: 9.0.2 WC Database Prefix: wp_ Total Database Size: 5.89MB Database Data Size: 3.04MB Database Index Size: 2.85MB wp_woocommerce_sessions: Data: 0.17MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.25MB + Index: 0.27MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 0.20MB + Index: 0.25MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 0.16MB + Index: 0.14MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.13MB + Index: 0.09MB + Engine InnoDB wp_jetpack_sync_queue: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Data: 0.47MB + Index: 0.09MB + Engine InnoDB wp_postmeta: Data: 0.14MB + Index: 0.11MB + Engine InnoDB wp_posts: Data: 0.13MB + Index: 0.06MB + Engine InnoDB wp_snippets: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.09MB + Index: 0.03MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.06MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_orders: Data: 0.05MB + Index: 0.11MB + Engine InnoDB wp_wc_orders_meta: Data: 0.09MB + Index: 0.17MB + Engine InnoDB wp_wc_order_addresses: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_bundle_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_operational_data: Data: 0.06MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.06MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.05MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_bundled_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_bundled_items: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_gc_activity: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_gc_cards: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_gc_cardsmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB ### Post Type Counts ### attachment: 29 page: 7 post: 1 product: 27 product_variation: 11 shop_coupon: 4 shop_order_placehold: 173 wp_navigation: 1 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ ### Active Plugins (18) ### Akismet Anti-spam: Spam Protection: by Automattic - Anti-spam Team – 5.3.3 Bulk Discounts for WooCommerce: by Plugify – 2.0.2 (update to version 2.0.3 is available) Code Snippets: by Code Snippets Pro – 3.6.5.1 Jetpack Protect: by Automattic - Jetpack Security team – 2.2.0 Jetpack: by Automattic – 13.7-a.1 Product Bundle Discount: by Codup – 1.1.4.1 Smart Product Quantity: by HighAddons – 1.0.6 Woo All Products For Subscriptions: by Woo – 5.0.5 (update to version 5.0.7 is available) WooCommerce Beta Tester: by WooCommerce – 2.3.1 WooCommerce Stripe Gateway: by WooCommerce – 8.4.0 Woo Gift Cards: by Woo – 1.17.0 WooCommerce Payments Dev Tools: by Automattic – WooPayments: by Automattic – 7.8.1 (update to version 7.9.1 is available) Woo Product Bundles: by Woo – 7.2.0 WooCommerce Shipping & Tax: by WooCommerce – 2.6.1 WooCommerce Stripe Dev Tools: by – WooCommerce Subscriptions: by WooCommerce – 6.4.1 (update to version 6.5.0 is available) WooCommerce: by Automattic – 9.1.1 (update to version 9.1.2 is available) ### Inactive Plugins (0) ### ### Dropin Plugins () ### advanced-cache.php: advanced-cache.php object-cache.php: Memcached ### Settings ### API Enabled: – Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: 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: 5 MB ### WC Pages ### Shop base: #9 - /shop/ Cart: #10 - /cart/ - Contains the woocommerce/cart block Checkout: #11 - /checkout/ - Contains the woocommerce/checkout block My account: #12 - /my-account/ Terms and conditions: ❌ Page not set ### Theme ### Name: Twenty Twenty-Four Version: 1.1 Author URL: https://wordpress.org Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ❌ Not declared ### Templates ### Overrides: /srv/htdocs/wp-content/plugins/woocommerce/templates/block-notices/error.php /srv/htdocs/wp-content/plugins/woocommerce/templates/block-notices/notice.php /srv/htdocs/wp-content/plugins/woocommerce/templates/block-notices/success.php ### WooPayments ### Version: 7.8.1 Connected to WPCOM: Yes WPCOM Blog ID: 234565615 Account ID: acct_1PVtvXC2Xmo7UoLK Payment Gateway: Enabled Test Mode: Enabled Enabled APMs: card 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 ### Subscriptions ### WCS_DEBUG: ✔ No Subscriptions Mode: ✔ Live Subscriptions Live URL: https://testpovilasstore.mystagingwebsite.com Subscriptions-core Library Version: 7.2.0 Subscription Statuses: – WooCommerce Account Connected: ❌ No Report Cache Enabled: ✔ Yes Cache Update Failures: ✔ 0 failure ### Store Setup ### Country / State: United States (US) — New York ### Subscriptions by Payment Gateway ### ### 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 Stripe: products refunds tokenization add_payment_method subscriptions subscription_cancellation subscription_suspension subscription_reactivation subscription_amount_changes subscription_date_changes subscription_payment_method_change subscription_payment_method_change_customer subscription_payment_method_change_admin multiple_subscriptions ### Gift Cards ### Database Version: 1.17.0 Loopback Test: – Task Queueing Test: ✔ ### Product Bundles ### Database Version: 7.2.0 Loopback Test: – Template Overrides: – ### 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 product-custom-fields remote-inbox-notifications remote-free-extensions payment-gateway-suggestions shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page launch-your-store Disabled Features: experimental-blocks minified-js pattern-toolkit-full-composability product-pre-publish-modal printful settings async-product-editor-category-field product-editor-template-system beta-tester-slotfill-examples Daily Cron: ✔ Next scheduled: 2024-07-16 19:15:11 +00:00 Options: ✔ Notes: 75 Onboarding: skipped ### All Products for Woo Subscriptions ### Template Overrides: – ### Action Scheduler ### Canceled: 9 Oldest: 2024-07-02 08:15:21 +0000 Newest: 2024-07-12 06:41:10 +0000 Complete: 588 Oldest: 2024-06-27 19:16:15 +0000 Newest: 2024-07-16 10:46:59 +0000 Failed: 2 Oldest: 2024-06-27 19:19:28 +0000 Newest: 2024-06-28 08:05:06 +0000 Pending: 1 Oldest: 2024-07-16 12:40:08 +0000 Newest: 2024-07-16 12:40:08 +0000 ### Status report information ### Generated at: 2024-07-16 10:47:23 +00:00 ` ```
dangermattic commented 1 month ago

Thanks for reporting! 👍

staskus commented 1 month ago

The behavior may be working as expected, closing as inconclusive/low priority: p1721127325826489-slack-C025A8VV728

staskus commented 1 month ago

The web works a bit differently but the results are the same, the shipping address needs to be set manually to recalculate taxes but the applied tax rate then makes the order total larger than the tax-inclusive product price:

image
staskus commented 1 month ago

Reported on Woo: https://github.com/woocommerce/woocommerce/issues/30702