Cart totals are wrong when using 1 decimal place.
-
Hi,
My cart does not add up totals correctly – For example a product that is £9 and says £9 in the cart, the total is £8 (when i change qauntity to x2 it does add it up correctly – £18, x3 it gets it wrong again – £26)
My shipping cost is also set to excatly £3 including tax but it rounds it up to £4. When i change it to £2.99, it rounds it down to £2.
When i change to 1 decimal place it all works fine but there is a .0 after everything.
I’ve deactived every plugin and changed theme to see if there a clash and there isn’t. All plugins up to date.
Any ideas please? The site is not live so i can’t share link. Thanks, Stuart
-
Hi @stuart2020,
Just so we get a better understanding of your setup, kindly share with us a copy of your site’s System Status.
You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”.? Once you’ve done that, paste it here in your response.
Thanks.
### WordPress Environment ### WordPress address (URL): https://staging-wwwkarookuco.kinsta.cloud Site address (URL): https://staging-wwwkarookuco.kinsta.cloud WC Version: 5.4.1 REST API Version: ? 5.4.1 WC Blocks Version: ? 5.1.0 Action Scheduler Version: ? 3.1.6 WC Admin Version: ? 2.3.1 Log Directory Writable: ? WP Version: 5.7.2 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ? Language: en_US External object cache: – ### Server Environment ### Server Info: nginx/1.19.10 PHP Version: 7.4.21 PHP Post Max Size: 128 MB PHP Time Limit: 300 PHP Max Input Vars: 10000 cURL Version: 7.68.0 OpenSSL/1.1.1f SUHOSIN Installed: – MySQL Version: 5.5.5-10.5.10-MariaDB-1:10.5.10+maria~focal-log Max Upload Size: 128 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 5.4.1 WC Database Prefix: wp_ Total Database Size: 47.49MB Database Data Size: 40.78MB Database Index Size: 6.71MB wp_woocommerce_sessions: Data: 0.06MB + 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.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + 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.05MB + Index: 0.11MB + 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.05MB + Index: 0.03MB + Engine InnoDB wp_ce4wp_abandoned_checkout: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_e_submissions: Data: 0.02MB + Index: 0.27MB + Engine InnoDB wp_e_submissions_actions_log: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wp_e_submissions_values: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailchimp_carts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailchimp_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_custom_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_dynamic_segment_filters: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_feature_flags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_forms: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_mapping_to_external_entities: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletters: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_newsletter_links: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_mailpoet_newsletter_option: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_option_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_posts: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_segment: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_templates: Data: 2.52MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_scheduled_tasks: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_scheduled_task_subscribers: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_segments: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_sending_queues: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_settings: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_statistics_clicks: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_mailpoet_statistics_forms: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_statistics_newsletters: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_statistics_opens: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_mailpoet_statistics_unsubscribes: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_mailpoet_statistics_woocommerce_purchases: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_mailpoet_stats_notifications: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_subscribers: Data: 0.02MB + Index: 0.13MB + Engine InnoDB wp_mailpoet_subscriber_custom_field: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_subscriber_ips: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_subscriber_segment: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_user_flags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Data: 3.03MB + Index: 0.06MB + Engine InnoDB wp_pmxi_files: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_hash: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_history: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_images: Data: 0.13MB + Index: 0.00MB + Engine InnoDB wp_pmxi_imports: Data: 0.23MB + Index: 0.00MB + Engine InnoDB wp_pmxi_posts: Data: 0.11MB + Index: 0.00MB + Engine InnoDB wp_pmxi_templates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_postmeta: Data: 20.17MB + Index: 2.67MB + Engine InnoDB wp_posts: Data: 10.06MB + Index: 0.52MB + Engine InnoDB wp_smush_dir_images: 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.20MB + Index: 0.14MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_notes: Data: 0.05MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.02MB + 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_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.06MB + Index: 0.09MB + 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_wpmm_subscribers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yoast_indexable: Data: 2.42MB + Index: 0.59MB + Engine InnoDB wp_yoast_indexable_hierarchy: Data: 0.05MB + Index: 0.05MB + Engine InnoDB wp_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_yoast_seo_links: Data: 0.02MB + Index: 0.03MB + Engine InnoDB ### Post Type Counts ### attachment: 1629 custom_css: 2 customize_changeset: 27 e-landing-page: 2 elementor_library: 35 mailpoet_page: 1 nav_menu_item: 38 oembed_cache: 3 page: 13 post: 3 product: 329 revision: 780 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (14) ### Elementor Pro: by Elementor.com – 3.3.0 Elementor: by Elementor.com – 3.2.5 Flexible Shipping: by WP Desk – 4.6.1 Mailchimp for WooCommerce: by Mailchimp – 2.5.1 WooCommerce PayPal Checkout Gateway: by WooCommerce – 2.1.2 WooCommerce Stripe Gateway: by WooCommerce – 5.2.3 WooCommerce PayPal Payments: by WooCommerce – 1.3.2 Woocommerce Side Cart Premium: by XootiX – 3.1 WP All Import - WooCommerce Add-On: by Soflyy – 1.4.8 WooCommerce: by Automattic – 5.4.1 Yoast SEO: by Team Yoast – 16.7 WP All Import: by Soflyy – 3.5.9 Smush: by WPMU DEV – 3.8.7 Custom Product Tabs for WooCommerce: by YIKES Inc. – 1.7.7 ### Inactive Plugins (7) ### Child Theme Configurator: by Lilaea Media – 2.5.8 Google Ads & Marketing by Kliken: by Kliken – 1.0.7 Premmerce Permalink Manager for WooCommerce: by premmerce – 2.3.1 Sales Booster for WooCommerce: by Footnote.io – 1.7.0 Side Cart WooCommerce: by XootiX – 2.1 Temporary Login Without Password: by StoreApps – 1.6.13 WP Maintenance Mode: by Designmodo – 2.4.0 ### Must Use Plugins (1) ### Kinsta Must-use Plugins: by Kinsta Team – 2.3.4 ### Settings ### API Enabled: – Force SSL: – Currency: GBP (£) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 0 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) 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: – ### WC Pages ### Shop base: #7 - /shop/ Cart: #8 - /cart/ Checkout: #9 - /checkout/ My account: #10 - /my-account/ Terms and conditions: ? Page not set ### Theme ### Name: Neve Child Version: 2.11.4.1623314477 Author URL: https://themeisle.com Child Theme: ? Parent Theme Name: Neve Parent Theme Version: 2.11.4 – 2.11.6 is available Parent Theme Author URL: https://themeisle.com WooCommerce Support: ? ### Templates ### Overrides: – ### Action Scheduler ### Complete: 79 Oldest: 2021-06-14 14:57:47 +0000 Newest: 2021-07-13 11:08:43 +0000 ### Status report information ### Generated at: 2021-07-13 11:19:29 +00:00
Hi @stuart2020
I see that your site is set for the number of decimals as zero. (
Number of Decimals: 0
).This can cause a number of issues in WooCommerce, because it is not simply a display setting: WooCommerce will actually take steps to round prices if this is set to zero.
This can cause errors in totals, and tax calculations, as you have discovered, especially since tax calculations almost always include decimal places.
If you are trying to prevent two zeroes from displaying behind whole numbers, however, there is a snippet of code that can deal with that, and which you can find here.
Set your price to two decimal places, and deploy the snippet in your child theme functions.php file or using your favorite Code Snippets plugin.
- This reply was modified 3 years, 4 months ago by nicw.a11n.
Hi,
Thank you. I’ve done that and it works if it is .00. It doesn’t round the numbers though. I’ll have to go through and enter round numbers.
Thanks for your help.
Stuart
Glad to hear it – thanks for letting us know!
I’ll mark this thread as resolved now. If you have any other questions, I recommend creating a new thread.
- The topic ‘Cart totals are wrong when using 1 decimal place.’ is closed to new replies.