-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mini-cart not updating when using back button (seems to affect Chrome only) #32454
Comments
We are adding the Thank you for your patience. |
Hi @SuperHanss, Thank you for taking the time to report this bug, we really appreciate your help. We are unable to reproduce the issue on our end using WooCommerce 6.3.1 version and WordPress 5.9.2 version. Please find below screencast for reference : 32454.mp4Please provide us more detailed and any additional steps required to repro this issue which may help us to evaluate it further. |
That is strange! This was tested using Chrome? I'm seeing the problem on both macOS Chrome and Android Chrome, not just on my site but many other sites using WooCommerce. Unfortunately I don't have any other devices to test it on, nor do I have the knowledge on debugging it further. |
Is anyone able to reproduce this with the latest Chrome? It's occuring on demo stores too - https://veganfoodshop.thunder-stores.com/ |
UPDATE: I've managed to get this working. It seems with Chrome a delay is needed before 'wc_fragment_refresh' can be triggered:
Simply adding a short delay to the script introduced in #747a6d5 successfully fires the Ajax request. Perhaps something to do with Chrome bfcache? @mikejolley @jonathansadowski |
Not sure why this was closed with can't reproduce? With the latest Chrome the issue is present in demo stores too using mobile and desktop. https://lumiere.thunder-stores.com Setting a timeout as stated above seems to fix it. |
I've re-opened the issue and tagged the development team for further review @SuperHanss. |
Hi @SuperHanss, Thank you for opening the issue! It requires further feedback from the WooCommerce Core team. We are adding the Please note it may take a few days for them to get to this issue. Thank you for your patience. |
I'm sorry, @SuperHanss, but I don't see this either. I've tested using Chrome (v101) on:
In each case there is a cart widget present and I can successfully visit a single product page, add to cart, then navigate back (via the browser's back button) and see that the cart widget updates appropriately, noting there is a small but expected delay first of all. I do note however that those demo sites appear to be using specific optimization techniques (including script concatenation), and perhaps those are or were causing issues in some cases? However, I couldn't see the issue myself on those or on our own demo site (which was just a clean WordPress 6.0 installation along with the latest version of WooCommerce). |
after open page cart back with button back browser mini cart cannot show list item mini cart, how to solution for this? i try in at site this (https://lumiere.thunder-stores.com/). |
I'm sorry, it works for me (using both Firefox and Chrome).
† I wanted to highlight that I navigated to the shop page manually: that's because, at time of writing, the "Shop Now" button on the homepage actually links to a different domain. I don't have the credentials needed to go to that other site, but if that happens to be the path you are following it might explain the unexpected behavior you have described. |
@barryhughes I appreciate you testing. Please try the following:
Tested with Windows 10 and macOS Monterey and problem occurs. Both devices using latest Chrome 102. |
error.v.mp4problem in use chrome browser, firefox it work. error wc-ajax=get_refreshed_fragments, status pending in chrome. |
OK, thank you: I can replicate (note to self, it's possible to see this using the Storefront theme). Re-opening and marking as a bug. At least in my testing, visiting the cart page itself, removing an item, and then hitting the back button was a required step. |
Hello, thanks for answering, when would you have it ready? , any possible request while they fix the error? |
We can't commit to a specific timeline, I'm afraid. In most cases, this hopefully impacts only a small subset of users and so isn't currently planned for an upcoming release. |
I am also getting this issue. Not sure how long it's been happening as i only discovered it this evening. Normally i use the links on my site to navigate, but i'm sure i have used the browser back button before and would have noticed, so it may be quite a recent bug. I can confirm for my site anyway this is happeing on Chrome desktop browser, Chrome on Android mobile and Brave. Edge and Firefox work fine although there appears to be a slight delay on Firefox where after hitting the back button the cart amount changes but then corrects. |
do you know if there is any short-term solution until they put the woocommerce update? |
@andrestr93 the script I'm using:
Setting a short timeout triggers 'wc_fragment_refresh' successfully and updates the cart. |
@SuperHanss hello, in the desktop version it works fine, but in the mobile version it fails me, do you have any other solution? Thank you 😀 |
Should be working on both Chrome for Mac/Windows (in fact all chromium based browsers) and Chrome for Android. Perhaps the script isn't being loaded? Have you cleared the cache? |
@SuperHanss It works correctly, what is not correct is the price of the mini-cart, that is, when I add items to the cart, it does not add up well |
@SuperHanss It works correctly in some versions of Google Crome but in others, trying with different mobiles, it does not work |
I'm affected by the same problem and unfortunately have to say that it probably affects all current woocommerce stores that use a mini-cart / cart based on refresh with I would like to add that I can also reproduce the problem - at least partially - in Firefox. In Firefox the Qty buttons are not loaded and only visible after executing the code snippet mentioned below. I hope this issue can be re-evaluated and will be fixed in an upcoming release. The solution in the developer console of the browser to issue the command jQuery(function($) {
$(document.body).trigger('wc_fragment_refresh');
}); worked for me within Chrome and Firefox and updated the mini-cart. However, due to lack of time, I have not yet been able to develop a resulting functions.php / PlugIn workaround solution. :/ I hope we'll find a stable working solution and i'm happy to help with further information if needed. |
@CodeAdminDe Hello, that code fragment in which script do I have to put it for it to work? |
Hey, you could put this into a separate js file and load it via The best way will be to resolve the issue. I really hope that the importance of the issue will be seen by the dev team of WooCommerce. 👍 |
37449592-hc |
@SuperHanss Thanks for the fix! It works. |
Hi @SuperHanss, is this bug still active? I couldn't replicate this locally and on the Storefront demo store. I am assuming it also fails on the website you provided, but because it is patched correct? |
Hi I no longer use or require the above fix so the issue must have been fixed somewhere down the line! |
Thank you @SuperHanss. Closing |
Prerequisites
Describe the bug
When adding a product to the cart then returning to the previous page using the back button, the mini-cart isn't refreshing and therefore doesn't show the correct number of items in cart. This issue only seems to affect Chrome as Safari and Firefox both correctly update when the back button is clicked.
Upon further inspection the request ?wc-ajax=get_refreshed_fragments is getting stuck on pending as shown in attached screen recording.
It's worth noting I've also checked for this behaviour on the Storefront demo site and it is indeed present.
Expected behavior
The cart contents should refresh with newly added item when clicking the back button and returning to the main shop page as is the case with Safari and Firefox.
Actual behavior
Cart doesn't refresh after clicking back button due to ?wc-ajax=get_refreshed_fragments request stuck on pending.
Steps to reproduce
Untitled.mp4
WordPress Environment
`
WordPress Environment
WordPress address (URL): https://woostersbakery.com
Site address (URL): https://woostersbakery.com
WC Version: 6.3.1
REST API Version: ✔ 6.3.1
WC Blocks Version: ✔ 6.9.0
Action Scheduler Version: ✔ 3.4.0
WC Admin Version: ✔ 3.2.1
Log Directory Writable: ✔
WP Version: 5.9.2
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: ✔
Language: en_GB
External object cache: –
Server Environment
Server Info: Apache
PHP Version: 8.0.16
PHP Post Max Size: 516 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.81.0
OpenSSL/1.1.1n
SUHOSIN Installed: –
MySQL Version: 5.7.23-23
Max Upload Size: 512 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔
Database
WC Database Version: 6.3.1
WC Database Prefix: ret_
Total Database Size: 34.48MB
Database Data Size: 24.25MB
Database Index Size: 10.23MB
ret_woocommerce_sessions: Data: 0.30MB + Index: 0.02MB + Engine InnoDB
ret_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
ret_woocommerce_order_items: Data: 0.06MB + Index: 0.02MB + Engine InnoDB
ret_woocommerce_order_itemmeta: Data: 2.52MB + Index: 3.02MB + Engine InnoDB
ret_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
ret_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
ret_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
ret_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_acfw_loyalprog_entries: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
ret_acfw_virtual_coupons: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
ret_actionscheduler_actions: Data: 0.38MB + Index: 0.59MB + Engine InnoDB
ret_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_actionscheduler_logs: Data: 0.33MB + Index: 0.27MB + Engine InnoDB
ret_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_comments: Data: 0.14MB + Index: 0.09MB + Engine InnoDB
ret_e_submissions: Data: 0.02MB + Index: 0.27MB + Engine InnoDB
ret_e_submissions_actions_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
ret_e_submissions_values: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_options: Data: 5.02MB + Index: 0.08MB + Engine InnoDB
ret_postmeta: Data: 3.08MB + Index: 2.98MB + Engine InnoDB
ret_posts: Data: 3.03MB + Index: 0.34MB + Engine InnoDB
ret_redirection_404: Data: 0.17MB + Index: 0.08MB + Engine InnoDB
ret_redirection_groups: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_redirection_items: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
ret_redirection_logs: Data: 0.09MB + Index: 0.05MB + Engine InnoDB
ret_snippets: Data: 0.05MB + Index: 0.00MB + Engine InnoDB
ret_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_tm_taskmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_tm_tasks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_usermeta: Data: 0.42MB + Index: 0.44MB + Engine InnoDB
ret_users: Data: 0.05MB + Index: 0.05MB + Engine InnoDB
ret_wc_admin_notes: Data: 0.05MB + Index: 0.00MB + Engine InnoDB
ret_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_wc_bookings_availability: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_wc_bookings_availabilitymeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_wc_booking_relationships: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
ret_wc_customer_lookup: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
ret_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_wc_order_product_lookup: Data: 0.05MB + Index: 0.06MB + Engine InnoDB
ret_wc_order_stats: Data: 0.05MB + Index: 0.05MB + Engine InnoDB
ret_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
ret_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
ret_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_woocommerce_pickup_locations_geodata: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
ret_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
ret_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
ret_wpr_rucss_resources: Data: 3.52MB + Index: 0.06MB + Engine InnoDB
ret_wpr_rucss_used_css: Data: 3.52MB + Index: 0.05MB + Engine InnoDB
ret_yoast_indexable: Data: 0.31MB + Index: 0.41MB + Engine InnoDB
ret_yoast_indexable_hierarchy: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
ret_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
ret_yoast_seo_links: Data: 0.06MB + Index: 0.03MB + Engine InnoDB
ret_zettle_queue: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
ret_zettle_woocommerce_id_map: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
Post Type Counts
attachment: 106
elementor_font: 2
elementor_library: 17
jb_store_css: 8
nav_menu_item: 8
page: 10
post: 1
product: 24
seedprod: 2
shop_coupon: 3
shop_order: 1630
shop_order_refund: 21
wc_pickup_location: 4
wp_global_styles: 1
Security
Secure connection (HTTPS): ✔
Hide errors from visitors: ✔
Active Plugins (18)
Code Snippets: by Code Snippets Pro – 2.14.3
Disable WooCommerce Bloat: by ospiotr – 2.6.5
Disable/Remove Google Fonts: by Fonts Plugin – 1.3.7
Elementor Pro: by Elementor.com – 3.6.2
Elementor: by Elementor.com – 3.5.6
Head & Footer Code: by Aleksandar Urosevic – 1.2.4
Jetpack: by Automattic – 10.7
Loco Translate: by Tim Whitlock – 2.6.1
Quantity Field on Shop Page for WooCommerce: by Wooassist – 1.4.2
Redirection: by John Godley – 5.2.3
Checkout Field Editor for WooCommerce (Pro): by ThemeHigh – 3.1.10
WooCommerce Stripe Gateway: by WooCommerce – 6.3.0
WooCommerce Shipping & Tax: by WooCommerce – 1.25.25
WooCommerce: by Automattic – 6.3.1
Yoast SEO: by Team Yoast – 18.4.1
WP Mail SMTP: by WPForms – 3.3.0
WP Rocket | Disable Google Font Optimization: by WP Rocket Support Team –
WP Rocket: by WP Media – 3.10.9
Inactive Plugins (6)
Advanced Coupons for WooCommerce Free: by Rymera Web Co – 4.0.3
Advanced Coupons for WooCommerce Premium: by Rymera Web Co – 3.1
Akismet Anti-Spam: by Automattic – 4.2.2
Astra Pro: by Brainstorm Force – 3.6.5
Loyalty Program for WooCommerce: by Rymera Web Co – 1.5
WooCommerce Admin: by WooCommerce – 3.3.1
Dropin Plugins (3)
advanced-cache.php: advanced-cache.php
db-error.php: db-error.php
maintenance.php: maintenance.php
Must Use Plugins (2)
Endurance Page Cache: by Mike Hansen – 2.2
SSO: by Garth Mortensen
Mike Hansen – 0.3
Settings
API Enabled: –
Force SSL: –
Currency: GBP (£)
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: ✔
WC Pages
Shop base: ❌ Page ID is set
but the page does not exist
Basket: ❌ Page does not contain the [woocommerce_cart] shortcode or the woocommerce/cart block.
Checkout: #8 - /checkout/
My account: #9 - /my-account/
Terms and conditions: #3 - /terms-of-service/
Theme
Name: Astra
Version: 3.7.9
Author URL: https://wpastra.com/about/?utm_source=theme_preview&utm_medium=author_link&utm_campaign=astra_theme
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: ✔
Templates
Overrides: –
Action Scheduler
Complete: 48
Oldest: 2022-03-01 22:00:35 +0000
Newest: 2022-03-31 15:11:54 +0100
Pending: 2
Oldest: 2022-04-04 16:37:56 +0100
Newest: 2022-04-27 22:09:29 +0100
Status report information
Generated at: 2022-04-01 14:51:58 +01:00
`
Isolating the problem
The text was updated successfully, but these errors were encountered: