2

コードをfunctions.php

で始まります

add_action( 'woocommerce_order_status_completed', 'do_something' );
here is my code

できます!でも入れたらplugin

if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {

    if ( ! class_exists( 'WC_Some_class' ) ) {

    class  WC_Some_class {
            public function __construct() {
            add_action( 'woocommerce_order_status_completed', 'do_something' );
}
script ...

}
}
// finally instantiate our plugin class and add it to the set of globals
        $WC_Some_class = new WC_Some_class();
    }
}

これは動作しません。それはなぜです?

4

1 に答える 1