Woocommerce Order Delivery插件更改显示位置

I'm working on a Woocommerce site that is using the following plugin: https://docs.woothemes.com/document/woocommerce-order-delivery/ ("WooCommerce Order Delivery")

The plugin is now displayed on the Checkout page under the billing fields in the checkout_shipping section, I am trying to change this location to the checkout_order_review section by hooking in to the functions.

But I can't seem to get it working.

My code in my functions.php:

function action_woocommerce_checkout_shipping( $instance ) {
global $woocommerce;

  if ( is_checkout() && $woocommerce->cart->needs_shipping() ) {
     echo 'Hi World!';
    if ( wc_od() ){
     echo 'Found wc_od function';
    }

    remove_action( 'woocommerce_checkout_shipping', 'checkout_content' );
  }
};

// add the action
add_action( 'woocommerce_checkout_shipping', 'action_woocommerce_checkout_shipping' );

My thought behind this code was that I remove the function 'checkout_content' which retrieves the plugin template and then add the action to the woocommerce_checkout_order_review function to display it in the order review section.

But my remove_action doesn't seem to work.

The code in the plugin that adds the checkout_content action:

protected function __construct() {
        // WP Hooks.
        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );

        // WooCommerce hooks.
        add_action( 'woocommerce_checkout_shipping', array( $this, 'checkout_content' ), 99 );
        add_action( 'woocommerce_checkout_process', array( $this, 'validate_delivery_date' ) );
        add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'update_order_meta' ) );

        // Delivery date validation hooks.
        add_filter( 'wc_od_validate_delivery_date', array( $this, 'validate_delivery_day' ), 10, 2 );
        add_filter( 'wc_od_validate_delivery_date', array( $this, 'validate_minimum_days' ), 10, 2 );
        add_filter( 'wc_od_validate_delivery_date', array( $this, 'validate_maximum_days' ), 10, 2 );
        add_filter( 'wc_od_validate_delivery_date', array( $this, 'validate_no_events' ), 10, 2 );
    }

Can someone maybe give me a push in the right direction? Am I doing this wrong ? or is there a better way of achieving this?

You have two issues.

Firstly you need to specify the execution priority when you remove action, or at least you do when it is anything other than the default, 10. In your case the execution priority is 99.

Secondly, checkout_content() is a class function, not a standalone function so you need to specify this in the function reference.

So your remove_action line of code will be:

remove_action( 'woocommerce_checkout_shipping', array( $the_class_variable, 'checkout_content' ), 99 );

where $the_class_variable is the instance of the class containing that __construct() function. How you refer to this depends on how the class has been instantiated in the plugin.

You can read about different ways of instantiating a class and the corresponding remove_action at http://jespervanengelen.com/different-ways-of-instantiating-wordpress-plugins/

You can read about remove_action this in https://codex.wordpress.org/Function_Reference/remove_action