class-wc-meta-box-order-items.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Order Data
  4. *
  5. * Functions for displaying the order items meta box.
  6. *
  7. * @author WooThemes
  8. * @category Admin
  9. * @package WooCommerce/Admin/Meta Boxes
  10. * @version 2.1.0
  11. */
  12. if ( ! defined( 'ABSPATH' ) ) {
  13. exit; // Exit if accessed directly
  14. }
  15. /**
  16. * WC_Meta_Box_Order_Items Class.
  17. */
  18. class WC_Meta_Box_Order_Items {
  19. /**
  20. * Output the metabox.
  21. *
  22. * @param WP_Post $post
  23. */
  24. public static function output( $post ) {
  25. global $post, $thepostid, $theorder;
  26. if ( ! is_int( $thepostid ) ) {
  27. $thepostid = $post->ID;
  28. }
  29. if ( ! is_object( $theorder ) ) {
  30. $theorder = wc_get_order( $thepostid );
  31. }
  32. $order = $theorder;
  33. $data = get_post_meta( $post->ID );
  34. include 'views/html-order-items.php';
  35. }
  36. /**
  37. * Save meta box data.
  38. *
  39. * @param int $post_id
  40. */
  41. public static function save( $post_id ) {
  42. /**
  43. * This $_POST variable's data has been validated and escaped
  44. * inside `wc_save_order_items()` function.
  45. */
  46. wc_save_order_items( $post_id, $_POST );
  47. }
  48. }