Skip to content

Instantly share code, notes, and snippets.

@jessepearson
Last active April 16, 2020 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessepearson/d870d34363d84d034d88d791a3a3c8d0 to your computer and use it in GitHub Desktop.
Save jessepearson/d870d34363d84d034d88d791a3a3c8d0 to your computer and use it in GitHub Desktop.
Allows the editing of the PayPal Standard Subscription ID even if it shouldn't be edited. Use at own risk.
<?php // do not copy this line
/**
* Allows the editing of the PayPal Standard Subscription ID even if it shouldn't be edited.
* Use at own risk.
*/
function jp_allow_edit_of_pp_standard_sub_payment_20200416( $payment_meta, $subscription ) {
// Make sure that what we're going to edit exists.
if ( isset( $payment_meta['paypal'] )
&& isset( $payment_meta['paypal']['post_meta'] )
&& isset( $payment_meta['paypal']['post_meta']['_paypal_subscription_id'] )
) {
// Set disabled to false to allow editing.
$payment_meta['paypal']['post_meta']['_paypal_subscription_id']['disabled'] = false;
}
return $payment_meta;
}
add_filter( 'woocommerce_subscription_payment_meta', 'jp_allow_edit_of_pp_standard_sub_payment_20200416', 100,2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment