2013-08-06 10:41:20 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-11-03 13:53:50 +00:00
|
|
|
* Order Data
|
2013-08-06 10:41:20 +00:00
|
|
|
*
|
|
|
|
* Functions for displaying the order items meta box.
|
|
|
|
*
|
2014-08-31 07:18:21 +00:00
|
|
|
* @author WooThemes
|
|
|
|
* @category Admin
|
2020-08-05 16:36:24 +00:00
|
|
|
* @package WooCommerce\Admin\Meta Boxes
|
2013-08-06 10:41:20 +00:00
|
|
|
* @version 2.1.0
|
|
|
|
*/
|
|
|
|
|
2014-09-20 20:05:06 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit; // Exit if accessed directly
|
|
|
|
}
|
2013-08-06 10:41:20 +00:00
|
|
|
|
2014-09-20 20:05:06 +00:00
|
|
|
/**
|
2015-11-03 12:28:01 +00:00
|
|
|
* WC_Meta_Box_Order_Items Class.
|
2014-09-20 20:05:06 +00:00
|
|
|
*/
|
2013-08-06 10:41:20 +00:00
|
|
|
class WC_Meta_Box_Order_Items {
|
|
|
|
|
|
|
|
/**
|
2015-11-03 12:28:01 +00:00
|
|
|
* Output the metabox.
|
2016-01-04 21:31:36 +00:00
|
|
|
*
|
|
|
|
* @param WP_Post $post
|
2013-08-06 10:41:20 +00:00
|
|
|
*/
|
|
|
|
public static function output( $post ) {
|
2015-08-05 12:10:23 +00:00
|
|
|
global $post, $thepostid, $theorder;
|
|
|
|
|
|
|
|
if ( ! is_int( $thepostid ) ) {
|
|
|
|
$thepostid = $post->ID;
|
|
|
|
}
|
2013-08-06 10:41:20 +00:00
|
|
|
|
2014-07-14 18:23:56 +00:00
|
|
|
if ( ! is_object( $theorder ) ) {
|
2014-08-15 12:29:21 +00:00
|
|
|
$theorder = wc_get_order( $thepostid );
|
2014-07-14 18:23:56 +00:00
|
|
|
}
|
2013-08-06 10:41:20 +00:00
|
|
|
|
|
|
|
$order = $theorder;
|
2014-07-14 18:23:56 +00:00
|
|
|
$data = get_post_meta( $post->ID );
|
2013-08-06 10:41:20 +00:00
|
|
|
|
2018-03-05 18:59:17 +00:00
|
|
|
include 'views/html-order-items.php';
|
2013-08-06 10:41:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-11-03 12:28:01 +00:00
|
|
|
* Save meta box data.
|
2016-01-04 21:31:36 +00:00
|
|
|
*
|
|
|
|
* @param int $post_id
|
2013-08-06 10:41:20 +00:00
|
|
|
*/
|
2017-11-20 11:47:16 +00:00
|
|
|
public static function save( $post_id ) {
|
|
|
|
/**
|
|
|
|
* This $_POST variable's data has been validated and escaped
|
|
|
|
* inside `wc_save_order_items()` function.
|
|
|
|
*/
|
2014-07-17 20:17:54 +00:00
|
|
|
wc_save_order_items( $post_id, $_POST );
|
2013-08-06 10:41:20 +00:00
|
|
|
}
|
2014-06-04 14:09:01 +00:00
|
|
|
}
|