WooCommerce Order从Completed到On-Hold本身

时间:2017-12-08 17:27:20

标签: wordpress woocommerce

以前在1-2天内标记为已完成的订单将再次进入"暂停"。

传递插件代码:

/**
 * Check if WooCommerce is active
 */
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {

    function your_shipping_method_init2() {
        if ( ! class_exists( 'WC_Your_Shipping_Method2' ) ) {
            class WC_Your_Shipping_Method2 extends WC_Shipping_Method {
                /**
                 * Constructor for your shipping class
                 *
                 * @access public
                 * @return void
                 */
                public function __construct() {
                    $this->id                 = 'dopdostavka2'; // Id for your shipping method. Should be uunique.
                    $this->method_title       = __( 'Дополнительная доставка ' );  // Title shown in admin
                    $this->method_description = __( 'Транспортная компания ' ); // Description shown in admin

                    $this->enabled            = "yes"; // This can be added as an setting but for this example its forced enabled
                    $this->title              = "Транспортная компания"; // This can be added as an setting but for this example its forced.

                    $this->init();
                }

                /**
                 * Init your settings
                 *
                 * @access public
                 * @return void
                 */
                function init() {
                    // Load the settings API
                    $this->init_form_fields(); // This is part of the settings API. Override the method to add your own settings
                    $this->init_settings(); // This is part of the settings API. Loads settings you previously init.

                    // Save settings in admin if you have any defined
                    add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
                }

                /**
                 * calculate_shipping function.
                 *
                 * @access public
                 * @param mixed $package
                 * @return void
                 */
                public function calculate_shipping( $package ) {
                    $rate = array(
                        'id' => $this->id,
                        'label' => $this->title,
                        'cost' => '0',
                        'calc_tax' => 'per_item'
                    );

                    // Register the rate
                    $this->add_rate( $rate );
                }
            }
        }
    }

    add_action( 'woocommerce_shipping_init', 'your_shipping_method_init2' );

    function add_your_shipping_method2( $methods ) {
        $methods['your_shipping_method2'] = 'WC_Your_Shipping_Method2';
        return $methods;
    }

    add_filter( 'woocommerce_shipping_methods', 'add_your_shipping_method2' );
}

0 个答案:

没有答案