Mike Jolley
b82dbb6354
Update fragment when removing from cart
...
Closes #18548
2018-01-22 10:50:57 +00:00
Mike Jolley
431b95dade
cart_hash_key param
2018-01-15 16:03:27 +00:00
Rasmus
a77bd11dad
Remove deprecated jQuery bind calls
...
As of jQuery 3.0, .bind() has been deprecated. It was superseded by the .on() method for attaching event handlers to a document since jQuery 1.7, so its use was already discouraged.
Since jQuery 1.7 or higher is included in the required WordPress version this seems like a safe and sane change.
2017-02-15 10:43:16 +01:00
Mike Jolley
ca04ee8e9f
Replace
2016-11-22 15:09:37 +00:00
Mike Jolley
747a6d51d1
Update mini cart after back button page load
...
Fixes #11646
2016-08-10 11:35:44 +01:00
Mike Jolley
99f6540fe9
Trigger fragment refresh after updating ajax cart
...
Fixes #11064
2016-06-08 12:06:40 +01:00
Kevin Killingsworth
543e091c2c
Fix for #10940 - wc_cart_hash
...
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.
2016-05-24 14:36:43 -05:00
Mike Bronner
de85e5be25
Add tests for localStorage
...
Some spiders will not error out on sessions storage, but will throw an exception on localstorage. For example, my site has been hit with the following almost on an hourly basis:
```
TypeError: Cannot call method 'setItem' of null
1
File https://maureentaylor.com/app/plugins/woocommerce/assets/js/frontend/cart-fragments.min.js line 1 in [anonymous]
```
2016-03-13 08:42:35 -07:00
Mike Jolley
7012ef5608
When updating cart hash, refresh all open tabs
...
Closes #8708
2015-10-26 11:50:25 +00:00
Jeff Stieler
55dae383af
Use named cart fragment refresh callback.
2015-10-06 12:16:15 -06:00
Jeff Stieler
61e6f708d5
Set timers to refresh cart fragments before they expire.
2015-10-06 12:14:17 -06:00
Jeff Stieler
e94969f5dd
Expire the mini cart fragment if it’s more than a day old.
2015-10-06 11:12:18 -06:00
Jeff Stieler
b2cbae6508
Assume we need to refresh a mini cart with items if there is no session creation timestamp.
2015-10-06 10:04:21 -06:00
Jeff Stieler
da573be59a
Store the cart session creation timestamp for expiration purposes.
...
Consider the cart session “created” when it’s refreshed and has items, or when the first item is added to cart.
2015-10-06 09:54:06 -06:00
Mike Jolley
d0c2c10c47
Made the linter happy
2015-07-27 17:55:37 +01:00
Mike Jolley
0ab151562a
Fix issues with trailing slashes on permalinks
...
Closes #8658
2015-07-27 11:56:07 +01:00
Mike Jolley
65f19d5ca7
Ajax variation handling
...
If there are more variations than the threshold allows (set to 20
currently) this loads the matching variation via ajax instead of inline
in the HTML. #8477
2015-07-09 15:56:20 +01:00
Shiva Poudel
8aff509ed7
Tweaks JSHint for cart and cart fragments
2015-06-10 23:11:21 +05:45
Claudio Sanches
1dadbb2842
Fixed coding standards for #7879
2015-04-13 12:37:22 -03:00
Danny van Kooten
88f2e690bb
Changing all inefficient selectors of $('body') to $(document.body), which is about 80% faster (and even more on mobile, see https://jsperf.com/jquery-body-vs-document-body-selector/2 ).
2015-04-03 14:21:47 +02:00
Mike Jolley
21c5513526
Added endpoint for faster ajax requests
2015-03-20 12:28:26 +00:00
Joe Flynn
652a66e3d1
ensure storage is writable when setting support flag. fixes #6755
2014-11-14 14:14:56 -05:00
Mike Jolley
2b4906bf4c
Prevent security error with try catch block Closes #5275
2014-04-07 14:34:47 +01:00
splashingpixels
6d2aa8b3c3
cart-fragments jshinted and standard coding fixes
2014-03-17 19:56:31 -07:00
toddlahman
13c24b410e
Removed (document).ready from jQuery scripts
...
jQuery(document).ready(function($) { is equivalent to calling
jQuery(function($) {.
http://api.jquery.com/ready/
2014-01-30 18:44:17 -08:00
Jared Cobb
9fc47db17f
Make frontend scripts safe to run on non WC pages (check for objects)
...
For a more detailed explaination of why this is helpful, see
Issue #4202 . In short, from a dev ops perspective, if we want to build /
concatonate our front end scripts into a single application.js file, we
need to ensure scripts first check for dependent global object helpers
before trying to use them. For example, there are several objects
(created via PHP using `wp_localize_script`) which generate objects such
as `wc_single_product_params`. These objects will not exist on most
other pages, however these scripts attempt to execute code that
references these objects.
2013-12-04 12:15:24 -07:00
Mike Jolley
cc40557077
filter for cart fragment #4132
2013-11-20 16:31:28 +00:00
Scott Basgaard
f3b2854638
woocommerce_json_search_products() is now a method of WC_AJAX. Use $this->json_search_products() instead.
2013-11-19 14:44:28 +01:00
Scott Basgaard
bee41fb7e5
woocommerce_get_refreshed_fragments() is no longer. Update where it was called to new Ajax class method.
2013-11-19 13:33:26 +01:00
Mike Jolley
34624fa4ca
Rather than check if cart has contents, standardize cart hash adn cookie so its refreshed once. Closes #3505 .
...
@coenjacobs for .14
2013-07-30 15:23:08 +01:00
Mike Jolley
feb8d759a8
Only refresh fragment when cart cookie > 0
2013-07-10 17:07:25 +01:00
Mike Jolley
4f0320fdb2
Refactor frontend scripts #3165
2013-06-11 13:31:41 +01:00
Mike Jolley
d0ee67d9e1
Trigger when loading fragments Closes #2985 .
2013-04-23 15:37:19 +01:00
Mike Jolley
422b07b262
Reveal cart on adding_to_cart action
2013-04-09 09:38:55 +01:00
Mike Jolley
9977031a5d
Nonces cannot be used on all pages with cache - removed them for add to cart actions + fixed caching for hiding the cart
2013-04-08 18:43:07 +01:00
Mike Jolley
d403f4d9bc
Split out fragment code into wc-cart-fragments Closes #2528
2013-02-26 12:15:12 +00:00