diff --git a/assets/js/admin/woocommerce_notices.js b/assets/js/admin/woocommerce_notices.js new file mode 100644 index 00000000000..1288c747acc --- /dev/null +++ b/assets/js/admin/woocommerce_notices.js @@ -0,0 +1,10 @@ +/** + * WooCommerce Notices JS + */ +jQuery( function ( $ ) { + + $('.woocommerce-tracker .button-primary').on('click',function() { + $('.woocommerce-tracker' ).slideUp(); + }); + +}); \ No newline at end of file diff --git a/assets/js/admin/woocommerce_notices.min.js b/assets/js/admin/woocommerce_notices.min.js new file mode 100644 index 00000000000..bc6c151d5f9 --- /dev/null +++ b/assets/js/admin/woocommerce_notices.min.js @@ -0,0 +1 @@ +jQuery(function(a){a(".woocommerce-tracker .button-primary").on("click",function(){a(".woocommerce-tracker").slideUp()})}); \ No newline at end of file diff --git a/includes/admin/class-wc-admin-assets.php b/includes/admin/class-wc-admin-assets.php index 58d898494e0..58adcba0327 100644 --- a/includes/admin/class-wc-admin-assets.php +++ b/includes/admin/class-wc-admin-assets.php @@ -89,6 +89,7 @@ class WC_Admin_Assets { wp_register_script( 'wc-admin-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'accounting', 'round', 'wc-enhanced-select', 'plupload-all', 'stupidtable' ), WC_VERSION ); wp_register_script( 'qrcode', WC()->plugin_url() . '/assets/js/admin/jquery.qrcode.min.js', array( 'jquery' ), WC_VERSION ); wp_register_script( 'stupidtable', WC()->plugin_url() . '/assets/js/stupidtable/stupidtable' . $suffix . '.js', array( 'jquery' ), WC_VERSION ); + wp_register_script( 'woocommerce_admin_notices', WC()->plugin_url() . '/assets/js/admin/woocommerce_notices' . $suffix . '.js', array( 'jquery' ), WC_VERSION ); // Chosen is @deprecated (2.3) in favour of select2, but is registered for backwards compat wp_register_script( 'ajax-chosen', WC()->plugin_url() . '/assets/js/chosen/ajax-chosen.jquery' . $suffix . '.js', array( 'jquery', 'chosen' ), WC_VERSION ); @@ -122,6 +123,9 @@ class WC_Admin_Assets { 'mon_decimal_point' => wc_get_price_decimal_separator() ) ); + // WooCommerce admin notices script should be included on all pages as notices show on any admin page. + wp_enqueue_script( 'woocommerce_admin_notices' ); + // WooCommerce admin pages if ( in_array( $screen->id, wc_get_screen_ids() ) ) { diff --git a/includes/admin/views/html-notice-tracking.php b/includes/admin/views/html-notice-tracking.php index 26209d79fcb..5f160af3694 100644 --- a/includes/admin/views/html-notice-tracking.php +++ b/includes/admin/views/html-notice-tracking.php @@ -6,10 +6,10 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } ?> -
+

', '' ); ?>

- +

diff --git a/includes/class-wc-tracker.php b/includes/class-wc-tracker.php index 314a47ed7b9..fbf97799d8f 100644 --- a/includes/class-wc-tracker.php +++ b/includes/class-wc-tracker.php @@ -43,6 +43,12 @@ class WC_Tracker { if ( $last_send && $last_send > apply_filters( 'woocommerce_tracker_last_send_interval', strtotime( '-1 week' ) ) ) { return; } + } else { + // Make sure there is at least a 10 minute delay between override sends, we dont want duplicate calls due to double clicking links. + $last_send = self::get_last_send_time(); + if ( $last_send && $last_send > strtotime( '-10 minutes' ) ) { + return; + } } $params = self::get_tracking_data();