woocommerce / storefront

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

storefront Mini Cart count and wc is not updating properly #2140

Open gmanhub3 opened 6 months ago

gmanhub3 commented 6 months ago

Describe the bug

Mini Cart count is not updating properly on Cart page.I Installed the fresh WP Version: 6.4.3 and WC Version: 8.6.1 and storefront (Version: 4.5.4) for testing purpose and try add this to the theme function.php this snippets but not working.

function enqueue_wc_cart_fragments() { wp_enqueue_script( 'wc-cart-fragments' ); } add_action( 'wp_enqueue_scripts', 'enqueue_wc_cart_fragments' );

I have no other plugin installed or theme just (wp,wc,storefront) fresh install.

Isolating the problem (mark completed items with an [x]):

add some items to with "add to cart button" and go to Cart page and try remove item or use plus/minus button change the item count in header mini-cart will not change and update the counter icon number

Screenshots

Screenshots

Expected behavior

when remove or add item with plus / minus button need to be update the mini cart icon counter dynamically without refresh the page

Browser Environment

Please provide as much detail as possible about your testing environment.

Bugs log and console

-chrome and firefox console no any error (Inspect mode)

-i turned on wp errors on wp-config.php no any errors define( ‘WP_DEBUG’, true ); define( ‘WP_DEBUG_DISPLAY’, true ); define( ‘WP_DEBUG_LOG’, true ); define( ‘SCRIPT_DEBUG’, true );

-i restarted the server and tested again the error logs no errors generated only this:

[Fri Mar 15 10:26:33.676904 2024] [mpm_prefork:notice] [pid 16707] AH00163: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations [Fri Mar 15 10:26:33.676991 2024] [core:notice] [pid 16707] AH00094: Command line: '/usr/sbin/apache2'

WordPress Environment

click for details

` WordPress address (URL): http://localhost Site address (URL): http://localhost WC Version: 8.6.1 REST API Version: ✔ 8.6.1 WC Blocks Version: ✔ 11.8.0-dev Action Scheduler Version: ✔ 3.7.1 Log Directory Writable: ❌ To allow logging make /var/www/html/wordpress/wp-content/uploads/wc-logs/ writable or define a custom WC_LOG_DIR. WP Version: 6.4.3 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ✔ Language: en_US External object cache: – ### Server Environment ### Server Info: Apache/2.4.52 (Ubuntu) PHP Version: 8.1.2-1ubuntu2.14 PHP Post Max Size: 8 MB PHP Time Limit: 3000 PHP Max Input Vars: 1000 cURL Version: 7.81.0 OpenSSL/3.0.2 SUHOSIN Installed: – MySQL Version: 8.0.36-0ubuntu0.22.04.1 Max Upload Size: 8 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### WC Database Version: 8.4.0 WC Database Prefix: wp_ Total Database Size: 5.26MB Database Data Size: 3.57MB Database Index Size: 1.69MB 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.02MB + 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.02MB + Index: 0.03MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Data: 2.48MB + Index: 0.06MB + Engine InnoDB wp_postmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_posts: Data: 0.06MB + 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.05MB + Index: 0.02MB + Engine InnoDB wp_wc_admin_notes: Data: 0.06MB + 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_addresses: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_operational_data: 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_orders: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wp_wc_orders_meta: 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 ### Post Type Counts ### customize_changeset: 3 page: 7 post: 2 product: 2 revision: 2 shop_order_placehold: 2 wp_navigation: 1 wp_template: 2 ### 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 – 8.6.1 ### Inactive Plugins (0) ### ### 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) 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 Woo.com: – Enforce Approved Product Download Directories: ✔ HPOS feature screen enabled: ✔ HPOS feature enabled: ✔ Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore HPOS data sync enabled: – ### WC Pages ### Shop base: #6 - / Cart: #7 - /index.php/cart/ Checkout: #8 - /index.php/checkout/ My account: #9 - /index.php/my-account/ Terms and conditions: ❌ Page not set ### Theme ### Name: Storefront Version: 4.5.4 Author URL: https://woo.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 core-profiler 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 product-variation-management product-virtual-downloadable product-external-affiliate product-grouped product-linked 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: customize-store minified-js new-product-management-experience product-pre-publish-modal settings async-product-editor-category-field Daily Cron: ✔ Next scheduled: 2024-03-14 20:28:49 +00:00 Options: ✔ Notes: 66 Onboarding: - ### Action Scheduler ### Complete: 31 Oldest: 2024-03-13 20:29:54 +0000 Newest: 2024-03-14 13:44:21 +0000 Failed: 1 Oldest: 2024-03-13 20:31:59 +0000 Newest: 2024-03-13 20:31:59 +0000 Pending: 1 Oldest: 2024-03-14 20:29:54 +0000 Newest: 2024-03-14 20:29:54 +0000 ### Status report information ### Generated at: 2024-03-14 14:06:47 +00:00
Aljullu commented 6 months ago

Thanks for opening this issue, @gmanhub3! I was able to reproduce what you described: the Storefront Mini-Cart doesn't update when the quantity changes in the Cart block.

Steps to reproduce:

  1. Update the Cart page so it’s using the Cart block instead of the Cart shortcode.
  2. Add a product to your cart.
  3. Go to the Cart page.
  4. Change the quantity of one of the products in your cart.
  5. Notice the Mini-Cart at the top right isn't updated.

Enregistrament de pantalla del 2024-03-18 15-49-19.webm

I will leave this issue open. It's unlikely we will focus on it soon, as we are currently prioritizing work in blocks and block themes, but we are always open to reviewing PRs if somebody wants to give this a chance. :slightly_smiling_face: