plugins - CampaignMonitor for WooCommerce - Move subscribe button

admin2025-06-03  3

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question

So I need to move the checkbox provided by CampaignMonitor for WooCommerce to a different part of the checkout screen. I've already managed to copy it to the right place via

add_action( 'woocommerce_after_checkout_billing_form', '\core\App::woocommerce_subscription_box' );

But I can't remove it from it's original location. Looking at the plugin, it starts with...

add_action('plugins_loaded', function(){
    // Truncated for brevity
    core\App::run();
});

In core\App::run() it just initiates the class, and in the constructor is

add_action('woocommerce_review_order_after_submit', array(__CLASS__, 'woocommerce_subscription_box'));

So we know how the action is being added, and I've tried all sorts but nothing works to remove the action from woocommerce_review_order_after_submit.

I've tried...

// Doesn't work
remove_action( 'woocommerce_review_order_after_submit', '\core\App::woocommerce_subscription_box' );

// Doesn't work
add_action('plugins_loaded', function() {
    remove_action( 'woocommerce_review_order_after_submit', '\core\App::woocommerce_subscription_box', 11 );
}, 11);

Can anyone understand why I can't seem to remove that action?

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question

So I need to move the checkbox provided by CampaignMonitor for WooCommerce to a different part of the checkout screen. I've already managed to copy it to the right place via

add_action( 'woocommerce_after_checkout_billing_form', '\core\App::woocommerce_subscription_box' );

But I can't remove it from it's original location. Looking at the plugin, it starts with...

add_action('plugins_loaded', function(){
    // Truncated for brevity
    core\App::run();
});

In core\App::run() it just initiates the class, and in the constructor is

add_action('woocommerce_review_order_after_submit', array(__CLASS__, 'woocommerce_subscription_box'));

So we know how the action is being added, and I've tried all sorts but nothing works to remove the action from woocommerce_review_order_after_submit.

I've tried...

// Doesn't work
remove_action( 'woocommerce_review_order_after_submit', '\core\App::woocommerce_subscription_box' );

// Doesn't work
add_action('plugins_loaded', function() {
    remove_action( 'woocommerce_review_order_after_submit', '\core\App::woocommerce_subscription_box', 11 );
}, 11);

Can anyone understand why I can't seem to remove that action?

Share Improve this question asked Jan 29, 2019 at 9:57 KeironLoweKeironLowe 1335 bronze badges 2
  • Try using an array for the callback name: remove_action( '...etc.', [ '\core\App', 'woocommerce_subscription_box' ] ); – Jacob Peattie Commented Jan 29, 2019 at 10:19
  • @JacobPeattie didn't work unfortunately. – KeironLowe Commented Jan 29, 2019 at 11:15
Add a comment  | 

1 Answer 1

Reset to default 0

This works for me (not hooked to plugins_loaded):

remove_action('woocommerce_review_order_after_submit', array('core\App', 'woocommerce_subscription_box'));

Note there's also an option in the plugin settings 'Show subscription option at checkout' which will also remove it...

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748963407a315201.html

最新回复(0)