Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 5180864

Browse files
committed
Update PPCP upgrade notice text & make dismissible
1 parent 9444241 commit 5180864

File tree

3 files changed

+40
-15
lines changed

3 files changed

+40
-15
lines changed

assets/js/admin/ppec-upgrade-notice.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,25 @@
4444
window.location = install_link;
4545
}, 50 );
4646
} );
47+
48+
// Dismiss button.
49+
$( document).on( 'click', '#ppec-migrate-notice button.notice-dismiss', function( e ) {
50+
$.ajax(
51+
{
52+
url: ajaxurl,
53+
method: 'POST',
54+
data: {
55+
action: 'ppec_dismiss_ppec_upgrade_notice',
56+
_ajax_nonce: $notice_row.attr( 'data-dismiss-nonce' )
57+
},
58+
dataType: 'json',
59+
success: function( res ) {
60+
$ppec_row.removeClass( 'hide-border' );
61+
}
62+
}
63+
);
64+
} );
65+
66+
updateUI();
67+
4768
})( jQuery, window, document );

includes/class-wc-gateway-ppec-plugin.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ public function maybe_run() {
170170
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
171171
add_action( 'wp_ajax_ppec_dismiss_notice_message', array( $this, 'ajax_dismiss_notice' ) );
172172

173-
add_action( 'after_plugin_row_' . plugin_basename( $this->file ), array( $this, 'ppec_upgrade_notice' ), 10, 3 );
174173
// Upgrade notice.
175174
add_action( 'after_plugin_row_' . plugin_basename( $this->file ), array( $this, 'ppec_upgrade_notice' ), 0, 3 );
175+
add_action( 'wp_ajax_ppec_dismiss_ppec_upgrade_notice', array( $this, 'ppec_upgrade_notice_dismiss_ajax' ) );
176176
}
177177

178178
public function bootstrap() {
@@ -508,6 +508,10 @@ public static function needs_shipping() {
508508
* @param string $status Status filter currently applied to the plugin list.
509509
*/
510510
public function ppec_upgrade_notice( $plugin_file, $plugin_data, $status ) {
511+
if ( 'yes' === get_transient( 'ppec-upgrade-notice-dismissed' ) ) {
512+
return;
513+
}
514+
511515
// Load styles & scripts required for the notice.
512516
wp_enqueue_style( 'ppec-upgrade-notice', plugin_dir_url( __DIR__ ) . '/assets/css/admin/ppec-upgrade-notice.css', array(), WC_GATEWAY_PPEC_VERSION );
513517
wp_enqueue_script( 'ppec-upgrade-notice-js', plugin_dir_url( __DIR__ ) . '/assets/js/admin/ppec-upgrade-notice.js', array(), WC_GATEWAY_PPEC_VERSION, false );
@@ -516,6 +520,12 @@ public function ppec_upgrade_notice( $plugin_file, $plugin_data, $status ) {
516520
include_once $this->plugin_path . 'templates/paypal-payments-upgrade-notice.php';
517521
}
518522

523+
public function ppec_upgrade_notice_dismiss_ajax() {
524+
check_ajax_referer( 'ppec-upgrade-notice-dismiss' );
525+
set_transient( 'ppec-upgrade-notice-dismissed', 'yes', MONTH_IN_SECONDS );
526+
wp_send_json_success();
527+
}
528+
519529
/* Deprecated Functions */
520530

521531
/**

templates/paypal-payments-upgrade-notice.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,22 @@
3131
);
3232
?>
3333

34-
<tr class="plugin-update-tr active notice-warning notice-alt" id="ppec-migrate-notice">
34+
<tr class="plugin-update-tr active notice-warning notice-alt" id="ppec-migrate-notice" data-dismiss-nonce="<?php echo esc_attr( wp_create_nonce( 'ppec-upgrade-notice-dismiss' ) ); ?>">
3535
<td colspan="4" class="plugin-update colspanchange">
36-
<div class="update-message notice inline notice-warning notice-alt">
36+
<div class="notice notice-error inline update-message notice-alt is-dismissible">
3737
<div class='ppec-notice-title ppec-notice-section'>
38-
<p>Upgrade to PayPal Payments: the best way to get paid with PayPal and WooCommerce</p>
38+
<p><strong>Action Required: Switch to WooCommerce PayPal Payments</strong></p>
3939
</div>
4040
<div class='ppec-notice-content ppec-notice-section'>
41-
<p><strong>WooCommerce PayPal Payments</strong> is a full-stack solution that offers powerful and flexible payment processing capabilities. Expand your business by connecting with over 370+ million active PayPal accounts around the globe. With PayPal, you can sell in 200+ markets and accept 100+ currencies. Plus, PayPal can automatically identify customer locations and offer country-specific, local payment methods.</p>
42-
43-
<p>Upgrade now and get access to these great features:</p>
44-
45-
<ul>
46-
<li>Give your customers their preferred ways to pay with one checkout solution. Accept <strong>PayPal</strong>, <strong>PayPal Credit</strong>, <strong>Pay Later</strong> options (available in the US, UK, France, and Germany), <strong>credit & debit cards</strong>, and country-specific, <strong>local payment methods</strong> on any device.</li>
47-
<li>Offer subscriptions and accept recurring payments as PayPal is compatible with <a target="_blank" href="https://woocommerce.com/products/woocommerce-subscriptions/"><strong>WooCommerce Subscriptions</strong></a>.</li>
48-
</ul>
41+
<p>As of 1 Sept 2021, PayPal Checkout is officially retired from WooCommerce.com, and support for this product will end as of 1 March 2022.</p>
42+
<p>We highly recommend upgrading to <a href="https://woocommerce.com/products/woocommerce-paypal-payments/" target="_blank">PayPal Payments</a>, the latest, fully supported extension that includes all of the features of PayPal Checkout and more.</p>
4943
</div>
5044
<div class='ppec-notice-buttons ppec-notice-section hidden'>
5145
<?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
52-
<a id="ppec-install-paypal-payments" href="<?php echo $paypal_payments_install_link; ?>" class="button button-primary woocommerce-save-button">Upgrade to PayPal Payments now</a>
46+
<a id="ppec-install-paypal-payments" href="<?php echo $paypal_payments_install_link; ?>" class="button button-primary">Upgrade to PayPal Payments now</a>
5347
<?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
54-
<a id="ppec-activate-paypal-payments" href="<?php echo $paypal_payments_activate_link; ?>" class="button button-primary woocommerce-save-button">Activate PayPal Payments now</a>
55-
<a href="https://woocommerce.com/products/woocommerce-paypal-payments/" target="_blank" class="button woocommerce-save-button">Learn more</a>
48+
<a id="ppec-activate-paypal-payments" href="<?php echo $paypal_payments_activate_link; ?>" class="button button-primary">Activate PayPal Payments now</a>
49+
<a href="https://docs.woocommerce.com/document/woocommerce-paypal-payments/paypal-payments-upgrade-guide/" target="_blank" class="button woocommerce-save-button">Learn more</a>
5650
</div>
5751
</div>
5852
</td>

0 commit comments

Comments
 (0)