Price display / transient problem
-
Our customer has woocommerce webshop which has problems:
When doing changes to products, sometimes seemingly all products will show their prices without tax included. Problem might be about only variable products, there are so many of them that it might seem that all products are affected, when really it is only variable products.
Prices work right when added to cart or in checkout, but when prices are shown, for example in product listings or in single product view, prices are shown without tax.
All the settings are seemingly right (include taxes etc).When price is showing wrong, it can be “fixed” by using normal edit product and by just adding a random category, save, remove that random category and save. Then prices show correctly once again.
Also quick editing sometimes messes up price of that particular product same way that sometimes all prices gets shown wrong. So price is shown without tax included. This will also get fixed with above edit,save,edit,save ritual.At least quick edit produces transient like this (when it produces that problem):
ID 759937 NAME wc_var_prices_26747 VALUE { "version":"1630921200", "f9e544f77b7eac7add281ef28ca5559f":{ "price":{"26748":"43.00","26749":"2.00"}, "regular_price":{"26748":"43.00","26749":"2.00"}, "sale_price":{"26748":"43.00","26749":"2.00"} }, "936942fb9da53706755893f4eafdb2f9":{ "price":{"26748":"34.68","26749":"1.61"}, "regular_price":{"26748":"34.68","26749":"1.61"}, "sale_price":{"26748":"34.68","26749":"1.61"} } } Expires 4 weeks
And as you can see, lower price hash (?) has different prices that above, and those prices on lower are indeed without tax included. Upper price hash (?) does have price correctly.
Also, how many transients should woocommerce produce “normally”? If I delete all transients, I get 5-10 more with every reload of my transients manager plugin.
What does that lower hash do? Where does it come from?
-
The
wc_var_prices_
transients are used to cache product prices for various situations, e.g. with tax or without tax based on the customer location. It sounds like something is going wrong on your site during that process.First, could you please send me a copy of your site’s system status report? You can find it under WooCommerce > Status in the dashboard. Click “Get system report” and then the “Copy for support” button. Once you’ve done that, paste it into your reply.
That will help us determine if a potential plugin conflict is happening here.
Second, I’d be curious to see, the next time this happens, if you can make it correct itself by going to WooCommerce > Status > Tools and clearing all transients, like this:
https://d.pr/i/GKWweM/KbrDQCsL2H
Let us know, thanks!
Do you have link to some resource that could tell me more about those two price hashes (?) in transient? Like in that codeblock in previous message. What produces that second one and what they do? There must be a reason why there are two of them and lower one seems to share its hash with some other transients (or so it seems).
I had db backup which had price display error showing, and I tried those Woocommerce tools, and they fixed the problem. Cleaner that that edit/save/edit/save ritual. ?? (WooCommerce > Status > Tools and clearing all transients)
Here is the system status report!
### WordPress Environment ### WordPress address (URL): https://www.xxxxxxx.fi Site address (URL): https://www.xxxxxxx.fi WC Version: 5.6.0 REST API Version: ? 5.6.0 WC Blocks Version: ? 5.5.1 Action Scheduler Version: ? 3.2.1 WC Admin Version: ? 2.5.1 Log Directory Writable: ? WP Version: 5.8 WP Multisite: – WP Memory Limit: 512 Mt WP Debug Mode: – WP Cron: ? Language: fi External object cache: – ### Server Environment ### Server Info: nginx/1.18.0 PHP Version: 7.4.22 PHP Post Max Size: 20 Mt PHP Time Limit: 60 PHP Max Input Vars: 1000 cURL Version: 7.68.0 OpenSSL/1.1.1f SUHOSIN Installed: – MySQL Version: 5.5.5-10.3.31-MariaDB-0ubuntu0.20.04.1 Max Upload Size: 20 Mt Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 5.6.0 WC Database Prefix: wp_ Tietokannan kokonaiskoko: 194.61MB Tietokannan tietojen koko: 129.71MB Tietokannan hakemiston koko: 64.90MB wp_woocommerce_sessions: Tiedot: 1.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_woocommerce_api_keys: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_woocommerce_attribute_taxonomies: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_woocommerce_downloadable_product_permissions: Tiedot: 0.02MB + Indeksi: 0.06MB + Moottori InnoDB wp_woocommerce_order_items: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_woocommerce_order_itemmeta: Tiedot: 0.11MB + Indeksi: 0.14MB + Moottori InnoDB wp_woocommerce_tax_rates: Tiedot: 0.02MB + Indeksi: 0.06MB + Moottori InnoDB wp_woocommerce_tax_rate_locations: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_woocommerce_shipping_zones: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_woocommerce_shipping_zone_locations: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_woocommerce_shipping_zone_methods: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_woocommerce_payment_tokens: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_woocommerce_payment_tokenmeta: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_woocommerce_log: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_actionscheduler_actions: Tiedot: 2.02MB + Indeksi: 1.56MB + Moottori InnoDB wp_actionscheduler_claims: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_actionscheduler_groups: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_actionscheduler_logs: Tiedot: 2.02MB + Indeksi: 0.81MB + Moottori InnoDB wp_berocket_termmeta: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_braapf_product_stock_status_parent: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_braapf_product_variation_attributes: Tiedot: 0.02MB + Indeksi: 0.05MB + Moottori InnoDB wp_braapf_term_taxonomy_hierarchical: Tiedot: 0.02MB + Indeksi: 0.05MB + Moottori InnoDB wp_braapf_variation_attributes: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_commentmeta: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_comments: Tiedot: 0.05MB + Indeksi: 0.09MB + Moottori InnoDB wp_ig_actions: Tiedot: 0.02MB + Indeksi: 0.08MB + Moottori InnoDB wp_ig_blocked_emails: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_ig_campaigns: Tiedot: 0.02MB + Indeksi: 0.05MB + Moottori InnoDB wp_ig_contactmeta: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_ig_contacts: Tiedot: 0.02MB + Indeksi: 0.06MB + Moottori InnoDB wp_ig_contacts_ips: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_ig_contact_meta: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_ig_forms: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_ig_links: Tiedot: 0.02MB + Indeksi: 0.05MB + Moottori InnoDB wp_ig_lists: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_ig_lists_contacts: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_ig_mailing_queue: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_ig_queue: Tiedot: 0.02MB + Indeksi: 0.13MB + Moottori InnoDB wp_ig_sending_queue: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_ig_workflows: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_ig_workflows_queue: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_import_detail_log: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_import_log_detail: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_import_postID: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_links: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_options: Tiedot: 4.22MB + Indeksi: 2.30MB + Moottori InnoDB wp_postmeta: Tiedot: 79.63MB + Indeksi: 30.09MB + Moottori InnoDB wp_posts: Tiedot: 17.50MB + Indeksi: 5.75MB + Moottori InnoDB wp_sbi_instagram_feeds_posts: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_sbi_instagram_feed_locator: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_sbi_instagram_posts: Tiedot: 0.22MB + Indeksi: 0.00MB + Moottori InnoDB wp_smackcsv_file_events: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_smackuci_events: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_termmeta: Tiedot: 0.09MB + Indeksi: 0.11MB + Moottori InnoDB wp_terms: Tiedot: 0.09MB + Indeksi: 0.09MB + Moottori InnoDB wp_term_relationships: Tiedot: 4.52MB + Indeksi: 4.52MB + Moottori InnoDB wp_term_taxonomy: Tiedot: 0.09MB + Indeksi: 0.11MB + Moottori InnoDB wp_tinvwl_analytics: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_tinvwl_items: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_tinvwl_lists: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_ultimate_csv_importer_acf_fields: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_ultimate_csv_importer_mappingtemplate: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_ultimate_csv_importer_media: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_ultimate_csv_importer_shortcode_manager: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_ultimate_post_entries: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_usermeta: Tiedot: 0.30MB + Indeksi: 0.23MB + Moottori InnoDB wp_users: Tiedot: 0.02MB + Indeksi: 0.05MB + Moottori InnoDB wp_wcsp_global_discount_rule_mapping: Tiedot: 0.02MB + Indeksi: 0.05MB + Moottori InnoDB wp_wcsp_group_category_pricing_mapping: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_wcsp_role_category_pricing_mapping: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_wcsp_user_category_pricing_mapping: Tiedot: 0.02MB + Indeksi: 0.05MB + Moottori InnoDB wp_wc_admin_notes: Tiedot: 0.05MB + Indeksi: 0.00MB + Moottori InnoDB wp_wc_admin_note_actions: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_wc_category_lookup: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_wc_customer_lookup: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_wc_download_log: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_wc_order_coupon_lookup: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_wc_order_product_lookup: Tiedot: 0.02MB + Indeksi: 0.06MB + Moottori InnoDB wp_wc_order_stats: Tiedot: 0.02MB + Indeksi: 0.05MB + Moottori InnoDB wp_wc_order_tax_lookup: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_wc_product_meta_lookup: Tiedot: 1.52MB + Indeksi: 2.52MB + Moottori InnoDB wp_wc_reserved_stock: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_wc_tax_rate_classes: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_wc_webhooks: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_wdi_feeds: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_wdi_themes: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_woof_query_cache: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_wpgmza: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_wpgmza_circles: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_wpgmza_maps: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_wpgmza_polygon: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_wpgmza_polylines: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_wpgmza_rectangles: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB wp_wusp_group_product_price_mapping: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_wusp_role_pricing_mapping: Tiedot: 4.52MB + Indeksi: 3.52MB + Moottori InnoDB wp_wusp_rules: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_wusp_subrules: Tiedot: 0.02MB + Indeksi: 0.08MB + Moottori InnoDB wp_wusp_user_pricing_mapping: Tiedot: 0.02MB + Indeksi: 0.05MB + Moottori InnoDB wp_yoast_indexable: Tiedot: 8.52MB + Indeksi: 8.97MB + Moottori InnoDB wp_yoast_indexable_hierarchy: Tiedot: 1.52MB + Indeksi: 2.16MB + Moottori InnoDB wp_yoast_migrations: Tiedot: 0.02MB + Indeksi: 0.02MB + Moottori InnoDB wp_yoast_primary_term: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_yoast_seo_links: Tiedot: 0.02MB + Indeksi: 0.03MB + Moottori InnoDB wp_yoast_seo_meta: Tiedot: 0.02MB + Indeksi: 0.00MB + Moottori InnoDB ### Post Type Counts ### acf-field: 101 acf-field-group: 8 attachment: 14690 br_filters_group: 1 br_product_filter: 7 customize_changeset: 1 deals: 1 es_template: 1 inspiroidu: 1 locateandfiltermap: 2 mallisto: 1 medialle: 53 ml-slide: 3 ml-slider: 1 nav_menu_item: 25 ohjeet: 12 page: 48 polylang_mo: 1 post: 100 product: 5745 product_variation: 3518 revision: 571 shop_coupon: 1 shop_order: 35 ultimate_slider: 7 wpcf7_contact_form: 1 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (23) ### Polylang: -- WP SYNTEX – 3.1.1 Advanced Custom Fields PRO -lis?osan: -- Elliot Condon – 5.8.8 Classic Editor: -- WordPress Contributors – 1.6.2 Contact Form 7: -- Takayuki Miyoshi – 5.4.2 Cookie Notice & Compliance for GDPR / CCPA: -- Hu-manity.co – 2.1.3 Customer Specific Pricing for WooCommerce: -- WisdmLabs – 4.6.2 Flashnode: -- Flashnode Oy – 2.0.0 Smash Balloon Instagram Feed: -- Smash Balloon – 2.9.3.1 Checkout Finland for WooCommerce: -- Checkout Finland – 1.6 Regenerate Thumbnails: -- Alex Mills (Viper007Bond) – 3.1.5 Smart WooCommerce Search: -- YummyWP – 2.2.5 Category Order and Taxonomy Terms Order: -- Nsp-Code – 1.5.7.5 TI WooCommerce Suosikit: -- TemplateInvaders – 1.28.3 Transients Manager: -- Pippin Williamson – 1.8.1 Slider Ultimate: -- Etoile Web Design – 1.1.8 User role based shipping methods: -- PluginValley – 1.0.5 User Role Editor: -- Vladimir Garagulya – 4.60.1 WOOF - WooCommerce Products Filter: -- realmag777 – 2.2.5.3 WooCommerce: -- Automattic – 5.6.0 Yoast SEO: -- Team Yoast – 17.0 WP Simple Mail Sender: -- Enrique Chavez – 1.0.2 WP Ultimate CSV Importer: -- Smackcoders – 6.2.6 ### Settings ### API Enabled: ? Force SSL: – Currency: EUR (€) Currency Position: right_space Thousand Separator: . Decimal Separator: , Number of Decimals: 2 Taxonomies: Product Types: simple (simple) grouped (grouped) variable (variable) external (external) Taxonomies: Product Visibility: exclude-from-search (exclude-from-search) exclude-from-catalog (exclude-from-catalog) 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 ### Kaupan polkutunnus: #18 - /shop/ Ostoskori: #19 - /cart/ Kassa: #20 - /checkout/ Oma tili: #21 - /my-account/ Tilaus- ja sopimusehdot: #342 - /toimitusehdot/ ### Theme ### Name: Custom Theme Version: 1.0 Author URL: https://www.xxxxxxxx.fi Child Theme: ? – Suositus: jos muokkaat WooCommercen is?nt?teemaa jota et itse ole tehnyt suosittelemme k?ytt?m??n lapsiteemaa. Katso: Kuinka luodaan lapsiteema WooCommerce Support: ? ### Templates ### Overrides: xxxxxxxx/woocommerce/archive-product.php xxxxxxxx/woocommerce/cart/cart-totals.php xxxxxxxx/woocommerce/cart/cart.php xxxxxxxx/woocommerce/content-single-product.php xxxxxxxx/woocommerce/myaccount/dashboard.php xxxxxxxx/woocommerce/myaccount/my-address.php xxxxxxxx/woocommerce/single-product/price.php xxxxxxxx/woocommerce/single-product.php ### TI WooCommerce Suosikit Templates ### Overrides: – ### Action Scheduler ### Valmis: 5?886 Oldest: 2021-08-09 12:12:13 +0000 Newest: 2021-09-07 18:48:16 +0000 ### Status report information ### Generated at: 2021-09-08 06:39:45 +02:00
I have functions that will make b2b customers (logged in users which “user_can(‘b2b’)”) as wc()->customer->set_is_vat_exempt(true). Also admin users have that b2b capability and therefore are tax exempt, I tried removing that tax exempt from admin and it did seem to help.
But then I logged in using b2b user credentials, and it messed up the prices again. b2b user which had that user_can(‘b2b’) and therefore was tax_exempt.
Problem stays away using line in functions.php:
WC_Cache_Helper::get_transient_version( ‘product’, true );
Hi @ramsestp ,
Thanks for sharing the System Status Report and the test results.
I can see that you have Customer Specific Pricing extension. I believe you are using this extension to offer different prices for your
b2b
user roles, right?Also, you have a few templates overrides that can modify the pricing area of the product page.
I will recommend performing a full conflict test to narrow the problem. You can follow these steps:
1. Temporarily switch your theme to the Storefront or Twenty Twenty theme.
2. Try to reproduce the problem:?
If the problem is resolved, it is a theme conflict. If not, continue to the next step.
3. Temporarily deactivate all plugins except WooCommerce.
4. Try to reproduce the problem again. If the problem is resolved, it is a plugin conflict. To figure out which plugin is causing the problem, continue to the next step.
5. Reactivate your other plugins one by one, testing after each, until you find the one causing conflict.For more detailed instructions, check out How to test for plugin and theme conflicts.
You can use Health Check plugin to safely enable troubleshooting mode and deactivate plugins, themes without affecting how your site is available to the visitors. See Troubleshooting using Health Check for more details.
Let us know how the test goes.
Thank you ??
Yeah, I am using Customer Specific Pricing to offer different prices to b2b user roles.
Problem seems to be theme.
Problem seems to be linked in that b2b users are tax_exempt, because logging in as b2b user, it will mess up the price display.
add_filter( 'init', 'make_b2b_tax_exempt' ); function make_b2b_tax_exempt() { if (is_user_logged_in() && !is_admin() && !is_null(wc()->customer)) { if( current_user_can ( 'b2b') && !current_user_can('administrator')) { $tax_exempt = current_user_can( 'b2b'); if($tax_exempt){ wc()->customer->set_is_vat_exempt($tax_exempt); } } } }
Could you tell me more, or do you have link to some resource that could tell me more about those two price hashes (?) in transient? Like in that codeblock in previous message. What produces that second one and what they do? There must be a reason why there are two of them and lower one seems to share its hash with some other transients (or so it seems).
Which functions take price directly from db and which functions use transients? Does some function take price from db and manipulate it to either show taxes for normal customer and without tax for those logged in users which have is_tax_exempt?
Hi again,
Could you tell me more, or do you have link to some resource that could tell me more about those two price hashes (?) in transient?
I could not find anything in particular for this. This is the best I could unearth: https://developer.woocommerce.com/2015/09/14/caching-and-dynamic-pricing-upcoming-changes-to-the-get_variation_prices-method/
Like in that codeblock in previous message. What produces that second one and what they do? There must be a reason why there are two of them and lower one seems to share its hash with some other transients (or so it seems). Which functions take price directly from db and which functions use transients? Does some function take price from db and manipulate it to either show taxes for normal customer and without tax for those logged in users which have is_tax_exempt?
I agree, but I am afraid we have no such developer documentation (At least none that I could find). One will have to drill down into the classes and trace the stack to see what is going on when.
Here is a starting point for you: https://github.com/woocommerce/woocommerce/blob/b19500728b4b292562afb65eb3a0c0f50d5859de/includes/data-stores/class-wc-product-variable-data-store-cpt.php#L256
Hope that helps a bit still.
Kind regards,
Hi @ramsestp
We’ve not heard back from you in a while, so I’m marking this thread as resolved. If you have further questions, please feel free to open a new topic.
- The topic ‘Price display / transient problem’ is closed to new replies.