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.
The coupon and update cart logic was tripping on each other
between the click handling and form submit handling.
This commit combines the event handler, then splits off from there.
Since the code is built to use a form submit for all the quanitities
already, I just made this an ajax call instead of a whole page call.
The result is the exactly the same and the .woocommerce div is replaced
with the resulting HTML.