diff --git a/includes/admin/class-wc-admin.php b/includes/admin/class-wc-admin.php
index 1dc9819acad..193a09aa5b7 100644
--- a/includes/admin/class-wc-admin.php
+++ b/includes/admin/class-wc-admin.php
@@ -164,7 +164,17 @@ class WC_Admin {
// Check to make sure we're on a WooCommerce admin page
if ( isset( $current_screen->id ) && apply_filters( 'woocommerce_display_admin_footer_text', in_array( $current_screen->id, $wc_pages ) ) ) {
// Change the footer text
- $footer_text = sprintf( __( 'If you like WooCommerce please leave us a ★★★★★ rating on WordPress.org. A huge thank you from WooThemes in advance!', 'woocommerce' ), 'https://wordpress.org/support/view/plugin-reviews/woocommerce?filter=5#postform' );
+ if ( ! get_option( 'woocommerce_admin_footer_text_rated' ) ) {
+ $footer_text = sprintf( __( 'If you like WooCommerce please leave us a %s★★★★★%s rating. A huge thank you from WooThemes in advance!', 'woocommerce' ), '', '' );
+ wc_enqueue_js( "
+ jQuery('a.wc-rating-link').click(function() {
+ jQuery.post( '" . WC()->ajax_url() . "', { action: 'woocommerce_rated' } );
+ jQuery(this).parent().text( jQuery(this).data( 'rated' ) );
+ });
+ " );
+ } else {
+ $footer_text = __( 'Thank you for selling with WooCommerce.', 'woocommerce' );
+ }
}
return $footer_text;
diff --git a/includes/class-wc-ajax.php b/includes/class-wc-ajax.php
index 033dad541a5..6606fe4ba7c 100644
--- a/includes/class-wc-ajax.php
+++ b/includes/class-wc-ajax.php
@@ -65,7 +65,8 @@ class WC_AJAX {
'term_ordering' => false,
'product_ordering' => false,
'refund_line_items' => false,
- 'delete_refund' => false
+ 'delete_refund' => false,
+ 'rated' => false
);
foreach ( $ajax_events as $ajax_event => $nopriv ) {
@@ -1969,6 +1970,14 @@ class WC_AJAX {
die();
}
+
+ /**
+ * Triggered when clicking the rating footer.
+ */
+ public static function rated() {
+ update_option( 'woocommerce_admin_footer_text_rated', 1 );
+ die();
+ }
}
WC_AJAX::init();