woocommerce / storefront

Official theme for WooCommerce
https://wordpress.org/themes/storefront/
959 stars 472 forks source link

Header menu cart does not update when product is removed from cart in the cart page. #2111

Closed CacheMeOwside closed 11 months ago

CacheMeOwside commented 1 year ago

Prerequisites

Describe the bug

Originally reported in the WooCommerce Support Forum: https://wordpress.org/support/topic/after-update-menucart-total-doesnt-recalculate-when-product-removed-from-cart/

In WooCommerce 7.8.1, header menu cart does not update instantly when a product is removed from the cart in the cart page.

Expected behavior

Header menu cart should update the cart instantly when a product is removed from the cart in the cart page.

Actual behavior

When a product is removed from the cart in the cart page, the header menu cart does not update the cart instantly unless the page is refreshed.

3 products added to cart:

Screenshot 2023-06-29 at 11 54 17 PM

"Belt" product removed from cart:

Screenshot 2023-06-29 at 11 57 04 PM

Steps to reproduce

  1. Add 2 or more products in the cart.
  2. Navigate to cart page and remove a product from the cart.
  3. The cart total gets recalculated. However, the header menu cart still shows the old value.

WordPress Environment

`

WordPress Environment

WordPress address (URL): http://xyz.local Site address (URL): http://xyz.local WC Version: 7.8.1 REST API Version: ✔ 7.8.1 WC Blocks Version: ✔ 10.2.4 Action Scheduler Version: ✔ 3.5.4 Log Directory Writable: ✔ WP Version: 6.2.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.30 PHP Post Max Size: 1,000 MB PHP Time Limit: 1200 PHP Max Input Vars: 4000 cURL Version: 7.84.0 (SecureTransport) OpenSSL/1.1.1q

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: 7.8.1 WC Database Prefix: wp_ Total Database Size: 11.02MB Database Data Size: 9.43MB Database Index Size: 1.59MB wp_woocommerce_sessions: Data: 0.02MB + 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.08MB + 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.06MB + Index: 0.03MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_e_events: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Data: 8.03MB + Index: 0.06MB + Engine InnoDB wp_postmeta: Data: 0.17MB + Index: 0.13MB + Engine InnoDB wp_posts: Data: 0.13MB + Index: 0.06MB + 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_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.06MB + Index: 0.02MB + Engine InnoDB wp_wc_admin_notes: Data: 0.08MB + Index: 0.00MB + 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_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.09MB + 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_wpforms_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB

Post Type Counts

attachment: 28 custom_css: 7 customize_changeset: 1 elementor_library: 1 oembed_cache: 5 page: 7 post: 9 product: 19 product_variation: 6 revision: 68 shop_coupon: 3 shop_order: 16 user_request: 1 wp_block: 2 wp_global_styles: 8 wpcode: 3 wpforms: 1

Security

Secure connection (HTTPS): ❌ Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates. Hide errors from visitors: ✔

Active Plugins (1)

WooCommerce: by Automattic – 7.8.1

Inactive Plugins (5)

Debug Bar: by wordpressdotorg – 1.1.3 Health Check & Troubleshooting: by The WordPress.org community – 1.5.1 Jetpack: by Automattic – 11.9.1 Woo Store Vacation: by MyPreview – 1.9.1 WPForms Lite: by WPForms – 1.8.1.3

Must Use Plugins (1)

Health Check Troubleshooting Mode: by – 1.8.1

Settings

API Enabled: – Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: 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 screen enabled: – HPOS feature enabled: – Order datastore: WC_Order_Data_Store_CPT HPOS data sync enabled: –

WC Pages

Shop base: woocommerce/woocommerce#23 - /shop/ Cart: woocommerce/woocommerce#24 - /cart/ Checkout: woocommerce/woocommerce#25 - /checkout/ My account: woocommerce/woocommerce#26 - /my-account/ Terms and conditions: ❌ Page not set

Theme

Name: Storefront Version: 4.3.0 Author URL: https://woocommerce.com/ 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: –

Admin

Enabled Features: activity-panels analytics product-block-editor coupons 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 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

Disabled Features: core-profiler minified-js new-product-management-experience product-variation-management settings async-product-editor-category-field

Daily Cron: ✔ Next scheduled: 2023-06-30 10:07:58 +00:00 Options: ✔ Notes: 130 Onboarding: completed

Action Scheduler

Complete: 111 Oldest: 2023-06-11 16:20:16 +0000 Newest: 2023-06-29 18:07:40 +0000

Failed: 5 Oldest: 2023-03-11 09:23:25 +0000 Newest: 2023-05-29 18:07:52 +0000

Pending: 1 Oldest: 2023-06-30 18:07:40 +0000 Newest: 2023-06-30 18:07:40 +0000

Status report information

Generated at: 2023-06-29 18:31:59 +00:00 `

Isolating the problem

xue28 commented 12 months ago

6473351-zen

rrennick commented 11 months ago

@Kaav-notabot Thanks for reporting the issue. The header cart is a feature of the Storefront theme. I'll transfer this issue to that repository.

katebopp commented 11 months ago

@Kaav-notabot Thanks for reporting the issue. The header cart is a feature of the Storefront theme. I'll transfer this issue to that repository.

Hi, thank you. Actually, I don't use Storefront- my theme is GeneratePress. If this issue occurs on my theme AND Storefront, then I'd think the issue is with woocommerce itself.

I first noticed the issue on June 23rd during a routine update process on the site I manage. I test everything on a staging site before updating the live site. After updating woo (to version 7.8.0 released 6/13/23), the menucart/header cart began this behavior. The problem has persisted through woo versions 7.8.1, 7.8.2, and 7.9.0. I know this because I keep track of my update experiences in a file.

I have resisted updating the live site because of this issue, but I'm starting to be itchy about having outdated code. Although the menucart problem is a small issue in some ways, confusion during the checkout flow causes chaos and lost orders. I am going to talk to the site owner about it this week. Maybe we will update anyway and add a note about it on our checkout page.

Well, I guess that's it. I am grateful for woocommerce and the folks that keep it running. Thanks.

gigitux commented 11 months ago

This issue is a duplicate of #2109.

gigitux commented 11 months ago

@katebopp From WooCommerce Core 7.8, the wc-cart-fragments isn't enqueued by default. There is a dedicated post about this topic on the developer blog of WooCommerce.

With #2113 I fixed this issue on Storefront theme.

katebopp commented 11 months ago

Ok I'll take a look, thanks

On Tue, Aug 1, 2023, 3:33 PM Luigi Teschio @.***> wrote:

@katebopp https://github.com/katebopp From WooCommerce Core 7.8, the wc-cart-fragments isn't enqueued by default. There is a dedicated post about this topic on the developer blog of WooCommerce https://developer.woocommerce.com/2023/06/16/best-practices-for-the-use-of-the-cart-fragments-api/ .

With #2113 https://github.com/woocommerce/storefront/pull/2113 I fixed this issue on Storefront theme.

— Reply to this email directly, view it on GitHub https://github.com/woocommerce/storefront/issues/2111#issuecomment-1660956821, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ5KX5TKS5VRMCNRI6OZNEDXTFKW5ANCNFSM6AAAAAA22NJKZQ . You are receiving this because you were mentioned.Message ID: @.***>