Allow for shipping method selection when using multiple packages.
Previous code selected/posted only the changed method, but multiple packages require all methods.
* Don't add shipping zone debug message when doing ajax
Prevent an issue where the "Customer matched zone" debug message is shown twice after first selecting a shipping method and then changing a product's quantity in cart and clicking Update cart.
* Don't pass event object to cart.update_cart
Prevent accidentally preserving cart notices when `wc_update_cart` event is triggered on body. If the event object is passed to update_cart() as the first param, it evaluates to true, forcing existing notices to be preserved.
* Pass custom arguments to cart.update_cart()
Instead of simply not passing the event object, pass any custom arguments, so it's possible to do something like: $( body ).trigger( 'wc_update_cart', true ); to still preserve notices if needed.
Fix for issue #11811https://github.com/woothemes/woocommerce/issues/11811
IE handles hitting <ENTER> on an input field differently than
Chrome or Firefox in that it finds the nearest submit button
and fires the event from it instead of the actual text field
from which the user hit <ENTER>.
This commit catches the <ENTER> key event before the submit happens
and forces the cart_submit handling on that event instead.
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.
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
The previous jQuery selector was on div.woocommerce,
which was also selecting other divs on the page.
This is more specific to the cart table on the page.
This update actually takes the code and refactors it into
two object handlers, cart and cart_shipping.
Also, more block comments are added to each function.