Sometimes it is needed to add "context" to a variations ajax request, in order modify the returned object content. For instance, in cases where the variation is part of a bundled variable product, we may need to modify the price, stock status or the description of the variation according to the "context".
If you have a search widget on the cart page which is wrapped in a div
(the default wrapper for widgets) the ajax cart would try to update on
search submit. This change ensures the search form is excluded on
`submit_click`.
Some themes add internal HTML to links, so this adjusts
to use currentTarget, which should always be the node on which
the event is subscribed instead of the target which triggered
the event.
wc_cart_hash was used as a key for localStorage
for all WooCommerce sites. If you were to load your
cart for two different sites in the same browser,
the two WooCommerce pages would contend over this key
and loop on trying to set this key in the localStorage
This commit prepends the site's ajax URL onto the wc_cart_hash
key name in localStorage, providing a unique key for each
WooCommerce site. This ends contention over the keys.
Fixes#10813
This adds a "clicked" attribute to clicked form buttons,
which augments Safari specifically since it sets activeElement
to the page body when a button is clicked.
The server shows a different page for the cart
when the cart is completely empty. The Cart AJAX
update subverted this and caused issue #10736 as
a result. Not to mention, the page just didn't look
good or functional with no items left in the cart.
This commit forces a reload any time the cart becomes
empty, which shows the empty page generated from
the server.
Fixes#10736
The cart was not getting updated in all cases
when products were removed or shipping was
updated. This ensures those changes update the
cart as well.
Fixes#10734
.wc-tabs-wrapper, .woocommerce-tabs, #rating set as delegated events, so that on ajax loading a product page, we can call
$( '.wc-tabs-wrapper, .woocommerce-tabs, #rating' ).trigger('init'); to make them work.