Skip to content
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

Enqueue wc-cart-fragments always, remove limit #2116

Merged
merged 2 commits into from
Aug 11, 2023
Merged

Conversation

albarin
Copy link
Contributor

@albarin albarin commented Aug 11, 2023

As stated in #2113

From WooCommerce Core 7.8, the wc-cart-fragments isn't enqueued by default anymore. This causes #2101. I followed the "Best practices for the use of the “cart fragments” API" post to fix the issue.

This PR removes the limit_cart_sync_to_wc_pages, since the cart is present on Storefront on every page we need to always load wc-cart-fragments and not limit it to only WC pages.

Fixes #2101 & #2114

How to test the changes in this Pull Request:

  1. Go to a non-WooCommerce page, hover over the cart icon on the header, and confirm it displays the pop-up with the cart info.
  2. Add some products to the cart and go to the cart page, update the quantity of some of them, and make sure it's updated on the cart widget.
  3. Enable a caching plugin (like WP Super Cache) and visit a non-WooCommerce page.
  4. Go to the Shop and add some more products to the cart. Go back to the cached non-WooCommerce page from the last step and check the cart has the correct products and amount.

Changelog

Fix: Enqueue wc-cart-fragments script on all pages.

@albarin albarin marked this pull request as ready for review August 11, 2023 09:48
Copy link
Contributor

@gigitux gigitux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the status: ready to merge Automatically applied to a pull when a pull is approved. Indicates ready for merging. label Aug 11, 2023
@albarin albarin merged commit 9b7bd43 into trunk Aug 11, 2023
@albarin albarin deleted the load-wc-cart-fragments branch August 11, 2023 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready to merge Automatically applied to a pull when a pull is approved. Indicates ready for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The "Storefront header cart" doesn't work properly on the cart and checkout pages
2 participants