Total ignores Variable Products
-
Hello Guys,
if I add a Variable Product (Product Variation) to the cart the cart total ignores the Price of the Variation.
If I output WC()->cart->total i only get the sum for simple Products.
I tried to output the total with WPGraphql the following way.
register_graphql_field(‘RootQuery’, ‘getCartTotal’, [
‘type’ => ‘string’,
‘description’ => ‘returns the Cart Total (its only a test field)’,
‘resolve’ => function($rootQuery, $args, $context, $info) {
$cart = WC()->cart;
$total = “NOT DEFINED”;
if ($cart) {
$total = $cart->total;
}
return json_encode($total);
}
]);`In Postman I also send the Session Header and the total is correct for simple Products.
The Cart also shows the Product Variation, so the product it is definitely in the cart.
Does anybody know this issue?Greetings
Julian- This topic was modified 2 years, 2 months ago by Julian Holzmayer.
-
Hi @julholdroid
I understand that the price of any variation added to the cart is not getting added to the cart total.
In order for us to get a better idea of your setup and the cause behind the issue, could you please share with us the following:
- 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.
- Fatal Error Log: Share a copy of any fatal error log found under WooCommerce > System Status > Logs (if available).
Hello Margaret,
thank you for the answer.
### WordPress Environment ### WordPress address (URL): https://wpafterupdate.local Site address (URL): https://wpafterupdate.local WC Version: 6.8.0 REST API Version: ? 6.8.0 WC Blocks Version: ? 8.0.0 Action Scheduler Version: ? 3.4.0 Log Directory Writable: ? WP Version: ? 6.0.1 - There is a newer version of WordPress available (6.0.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.16.0 PHP Version: 7.4.1 PHP Post Max Size: 1,000 MB PHP Time Limit: 1200 PHP Max Input Vars: 4000 cURL Version: 7.67.0 OpenSSL/1.1.1d SUHOSIN Installed: – MySQL Version: 8.0.16 Max Upload Size: 300 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 6.8.0 WC Database Prefix: wYHDA_ Total Database Size: 33.39MB Database Data Size: 30.93MB Database Index Size: 2.46MB wYHDA_woocommerce_sessions: ? Table does not exist wYHDA_woocommerce_api_keys: ? Table does not exist wYHDA_woocommerce_attribute_taxonomies: ? Table does not exist wYHDA_woocommerce_downloadable_product_permissions: ? Table does not exist wYHDA_woocommerce_order_items: ? Table does not exist wYHDA_woocommerce_order_itemmeta: ? Table does not exist wYHDA_woocommerce_tax_rates: ? Table does not exist wYHDA_woocommerce_tax_rate_locations: ? Table does not exist wYHDA_woocommerce_shipping_zones: ? Table does not exist wYHDA_woocommerce_shipping_zone_locations: ? Table does not exist wYHDA_woocommerce_shipping_zone_methods: ? Table does not exist wYHDA_woocommerce_payment_tokens: ? Table does not exist wYHDA_woocommerce_payment_tokenmeta: ? Table does not exist wYHDA_woocommerce_log: ? Table does not exist wyhda_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wyhda_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wyhda_fsmpt_email_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wyhda_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_options: Data: 3.38MB + Index: 0.06MB + Engine InnoDB wyhda_postmeta: Data: 1.52MB + Index: 0.20MB + Engine InnoDB wyhda_posts: Data: 21.52MB + Index: 0.30MB + Engine InnoDB wyhda_rank_math_internal_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_rank_math_internal_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wyhda_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_usermeta: Data: 0.14MB + Index: 0.03MB + Engine InnoDB wyhda_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wyhda_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB wyhda_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wyhda_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wyhda_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wyhda_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wyhda_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wyhda_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_wfpklist_template_data: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wyhda_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wyhda_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_woocommerce_sessions: Data: 3.02MB + Index: 0.25MB + Engine InnoDB wyhda_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wyhda_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wyhda_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wyhda_wpforms_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wyhda_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wyhda_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wyhda_yoast_indexable: Data: 0.23MB + Index: 0.20MB + Engine InnoDB wyhda_yoast_indexable_hierarchy: Data: 0.06MB + Index: 0.05MB + Engine InnoDB wyhda_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wyhda_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wyhda_yoast_seo_links: Data: 0.02MB + Index: 0.03MB + Engine InnoDB ### Post Type Counts ### attachment: 268 bc_kundenfeedback: 7 faqs: 25 nav_menu_item: 39 page: 21 post: 1 product: 7 product_variation: 4 revision: 1133 shop_coupon: 8 shop_order: 2 wp_block: 6 wp_global_styles: 4 wp_template: 1 ### Security ### Secure connection (HTTPS): ? Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates. Hide errors from visitors: ?Error messages should not be shown to visitors. ### Active Plugins (10) ### Add WPGraphQL SEO: by Ash Hitchcock – 4.18.1 Custom Balcosy Plugin: by – FaustWP: by WP Engine – 0.7.10 FluentSMTP: by FluentSMTP & WPManageNinja Team – 2.1.2 WooCommerce PDF Invoices, Packing Slips, Delivery Notes and Shipping Labels: by WebToffee – 3.0.4 WooCommerce: by Automattic – 6.8.0 (update to version 6.9.4 is available) WordPress Importer: by wordpressdotorg – 0.7 Yoast SEO: by Team Yoast – 19.5.1 WPGraphQL WooCommerce (WooGraphQL): by kidunot89 – 0.10.7 WP GraphQL: by WPGraphQL – 1.9.1 ### Inactive Plugins (0) ### ### Settings ### API Enabled: – Force SSL: – Currency: EUR (€) Currency Position: left Thousand Separator: Decimal Separator: , Number of Decimals: 2 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: – Enforce Approved Product Download Directories: – ### WC Pages ### Shop base: ? Page ID is set but the page does not exist Cart: ? Page ID is set but the page does not exist Checkout: ? Page ID is set but the page does not exist My account: ? Page ID is set but the page does not exist Terms and conditions: ? Page not set ### Theme ### Name: Balcosy Theme Version: 1.0 Author URL: 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: – ### Admin ### Enabled Features: activity-panels analytics coupons customer-effort-score-tracks experimental-products-task experimental-import-products-task experimental-fashion-sample-products experimental-product-tour shipping-smart-defaults shipping-setting-tour homescreen marketing mobile-app-banner navigation onboarding onboarding-tasks remote-inbox-notifications remote-free-extensions payment-gateway-suggestions shipping-label-banner subscriptions store-alerts transient-notices wc-pay-promotion wc-pay-welcome-page wc-pay-subscriptions-page Disabled Features: minified-js settings Daily Cron: ? Next scheduled: 2022-09-28 21:16:06 +00:00 Options: ? Notes: 76 Onboarding: completed ### Action Scheduler ### Complete: 45 Oldest: 2022-08-29 16:21:16 +0000 Newest: 2022-09-28 12:46:32 +0000 Pending: 2 Oldest: 2022-09-28 13:02:45 +0000 Newest: 2022-10-03 09:54:39 +0000 ### Status report information ### Generated at: 2022-09-28 12:46:38 +00:00
NOTE: I use Woocommerce in a Headless way over WPGraphql, but the WC()->cart->total should output the same way it does without graphql. I am not getting any error Logs (I have WP_DEBUG set to true and developing localy with Local by Flywheel.
If i output it via WPGraphql i also get the correct total for Single Products.- This reply was modified 2 years, 1 month ago by Julian Holzmayer.
Hi @julholdroid,
Thank you for your system status report.
Support for customizations is limited on this forum as we’re focusing more on the default WooCommerce core features. What I recommend is making sure all your software is up to date and temporarily disabling plugins as mentioned in our testing for conflicts guide.
If you need more help with this moving forward, I can also recommend the following resources for help:
That said, I’m going to leave the thread open for a bit to see if anyone is able to chime in to help you out.
Cheers.
- The topic ‘Total ignores Variable Products’ is closed to new replies.