WC_Meta_Box_Order_Actions::save() public WC 1.0
Save meta box data.
{} Это метод класса: WC_Meta_Box_Order_Actions{}
Хуки из метода
Возвращает
Null. Ничего.
Использование
$result = WC_Meta_Box_Order_Actions::save( $post_id, $post );
- $post_id(число) (обязательный)
- Post ID.
- $post(WP_Post) (обязательный)
- Post Object.
Код WC_Meta_Box_Order_Actions::save() WC Meta Box Order Actions::save WC 4.9.0
public static function save( $post_id, $post ) {
// Order data saved, now get it so we can manipulate status.
$order = wc_get_order( $post_id );
// Handle button actions.
if ( ! empty( $_POST['wc_order_action'] ) ) { // @codingStandardsIgnoreLine
$action = wc_clean( wp_unslash( $_POST['wc_order_action'] ) ); // @codingStandardsIgnoreLine
if ( 'send_order_details' === $action ) {
do_action( 'woocommerce_before_resend_order_emails', $order, 'customer_invoice' );
// Send the customer invoice email.
WC()->payment_gateways();
WC()->shipping();
WC()->mailer()->customer_invoice( $order );
// Note the event.
$order->add_order_note( __( 'Order details manually sent to customer.', 'woocommerce' ), false, true );
do_action( 'woocommerce_after_resend_order_email', $order, 'customer_invoice' );
// Change the post saved message.
add_filter( 'redirect_post_location', array( __CLASS__, 'set_email_sent_message' ) );
} elseif ( 'send_order_details_admin' === $action ) {
do_action( 'woocommerce_before_resend_order_emails', $order, 'new_order' );
WC()->payment_gateways();
WC()->shipping();
WC()->mailer()->emails['WC_Email_New_Order']->trigger( $order->get_id(), $order );
do_action( 'woocommerce_after_resend_order_email', $order, 'new_order' );
// Change the post saved message.
add_filter( 'redirect_post_location', array( __CLASS__, 'set_email_sent_message' ) );
} elseif ( 'regenerate_download_permissions' === $action ) {
$data_store = WC_Data_Store::load( 'customer-download' );
$data_store->delete_by_order_id( $post_id );
wc_downloadable_product_permissions( $post_id, true );
} else {
if ( ! did_action( 'woocommerce_order_action_' . sanitize_title( $action ) ) ) {
do_action( 'woocommerce_order_action_' . sanitize_title( $action ), $order );
}
}
}
}