Merge branch 'master' into persist-workflow-documents
This commit is contained in:
@@ -18,7 +18,7 @@ class Wiaas_Admin_Delivery_Process_Order {
|
|||||||
|
|
||||||
add_action('add_meta_boxes', array(__CLASS__, 'add_delivery_process_metabox'), 100 );
|
add_action('add_meta_boxes', array(__CLASS__, 'add_delivery_process_metabox'), 100 );
|
||||||
|
|
||||||
add_action('woocommerce_process_shop_order_meta', array(__CLASS__, 'maybe_assign_delivery_process'));
|
add_action('woocommerce_process_shop_order_meta', array(__CLASS__, 'maybe_assign_delivery_process'), 999);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ class Wiaas_Checkout {
|
|||||||
|
|
||||||
do_action( 'woocommerce_checkout_order_processed', $order_id, array(), $order );
|
do_action( 'woocommerce_checkout_order_processed', $order_id, array(), $order );
|
||||||
|
|
||||||
$order->payment_complete();
|
//Change order status from default 'Pending payment' to open (custom wiaas status)
|
||||||
|
$order->update_status('open');
|
||||||
|
|
||||||
WC()->cart->empty_cart( true );
|
WC()->cart->empty_cart( true );
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ class Wiaas_Delivery_Process {
|
|||||||
update_post_meta($order_id, 'wiaas_delivery_process_id', $process_id);
|
update_post_meta($order_id, 'wiaas_delivery_process_id', $process_id);
|
||||||
update_post_meta($order_id, 'wiaas_delivery_process_entry_id', $process_entry_id);
|
update_post_meta($order_id, 'wiaas_delivery_process_entry_id', $process_entry_id);
|
||||||
|
|
||||||
|
$order = wc_get_order($order_id);
|
||||||
|
|
||||||
|
$order->set_status('processing', 'Started order delivery process.', true);
|
||||||
|
$order->save();
|
||||||
|
|
||||||
return $process_entry_id;
|
return $process_entry_id;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ class Wiaas_Order {
|
|||||||
|
|
||||||
add_filter('woocommerce_register_post_type_shop_order', array(__CLASS__, 'manage_order_settings'));
|
add_filter('woocommerce_register_post_type_shop_order', array(__CLASS__, 'manage_order_settings'));
|
||||||
|
|
||||||
|
add_filter( 'woocommerce_register_shop_order_post_statuses', array(__CLASS__, 'register_custom_order_statuses'), 10, 1);
|
||||||
|
|
||||||
|
add_filter( 'wc_order_statuses', array(__CLASS__, 'add_custom_statuses_to_list' ), 10, 1);
|
||||||
|
|
||||||
|
add_filter( 'bulk_actions-edit-shop_order', array(__CLASS__, 'add_custom_statuses_to_bulk_edit' ), 10, 1);
|
||||||
|
|
||||||
add_filter('woocommerce_rest_check_permissions', array( __CLASS__, 'check_order_access'), 10, 4);
|
add_filter('woocommerce_rest_check_permissions', array( __CLASS__, 'check_order_access'), 10, 4);
|
||||||
|
|
||||||
add_filter('woocommerce_rest_prepare_shop_order_object', array(__CLASS__, 'transform_rest_order'), 999, 3);
|
add_filter('woocommerce_rest_prepare_shop_order_object', array(__CLASS__, 'transform_rest_order'), 999, 3);
|
||||||
@@ -203,6 +209,51 @@ class Wiaas_Order {
|
|||||||
return $order->get_meta('_wiaas_delivery_suppliers');
|
return $order->get_meta('_wiaas_delivery_suppliers');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register additional order statuses
|
||||||
|
*
|
||||||
|
* @param array $order_statuses
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function register_custom_order_statuses($order_statuses){
|
||||||
|
// Status must start with "wc-"
|
||||||
|
$order_statuses['wc-open'] = array(
|
||||||
|
'label' => _x( 'Open', 'Order status', 'woocommerce' ),
|
||||||
|
'public' => false,
|
||||||
|
'exclude_from_search' => false,
|
||||||
|
'show_in_admin_all_list' => true,
|
||||||
|
'show_in_admin_status_list' => true,
|
||||||
|
'label_count' => _n_noop( 'Open <span class="count">(%s)</span>', 'Open <span class="count">(%s)</span>', 'woocommerce' ),
|
||||||
|
);
|
||||||
|
return $order_statuses;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* display custom wiaas statuses in order status dropdown
|
||||||
|
*
|
||||||
|
* @param array $order_statuses
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function add_custom_statuses_to_list($order_statuses){
|
||||||
|
$order_statuses['wc-open'] = _x( 'Open', 'Order status', 'woocommerce' );
|
||||||
|
return $order_statuses;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* display custom wiaas statuses in bulk actions
|
||||||
|
*
|
||||||
|
* @param array $bulk_actions
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function add_custom_statuses_to_bulk_edit($bulk_actions){
|
||||||
|
// Note: "mark_" must be there instead of "wc"
|
||||||
|
$bulk_actions['mark_open'] = 'Change status to open';
|
||||||
|
return $bulk_actions;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update `shop_order` post type settings before creation to enable better order management for wiaas
|
* Update `shop_order` post type settings before creation to enable better order management for wiaas
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user