Нема описа

class-wc-order-item-data-store-interface.php 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /**
  3. * Order Item Data Store Interface
  4. *
  5. * @version 3.0.0
  6. * @package WooCommerce\Interface
  7. */
  8. /**
  9. * WC Order Item Data Store Interface
  10. *
  11. * Functions that must be defined by the order item data store (for functions).
  12. *
  13. * @version 3.0.0
  14. */
  15. interface WC_Order_Item_Data_Store_Interface {
  16. /**
  17. * Add an order item to an order.
  18. *
  19. * @param int $order_id Order ID.
  20. * @param array $item order_item_name and order_item_type.
  21. * @return int Order Item ID
  22. */
  23. public function add_order_item( $order_id, $item );
  24. /**
  25. * Update an order item.
  26. *
  27. * @param int $item_id Item ID.
  28. * @param array $item order_item_name or order_item_type.
  29. * @return boolean
  30. */
  31. public function update_order_item( $item_id, $item );
  32. /**
  33. * Delete an order item.
  34. *
  35. * @param int $item_id Item ID.
  36. */
  37. public function delete_order_item( $item_id );
  38. /**
  39. * Update term meta.
  40. *
  41. * @param int $item_id Item ID.
  42. * @param string $meta_key Meta key.
  43. * @param mixed $meta_value Meta value.
  44. * @param string $prev_value Previous value (default: '').
  45. * @return bool
  46. */
  47. public function update_metadata( $item_id, $meta_key, $meta_value, $prev_value = '' );
  48. /**
  49. * Add term meta.
  50. *
  51. * @param int $item_id Item ID.
  52. * @param string $meta_key Meta key.
  53. * @param mixed $meta_value Meta value.
  54. * @param bool $unique Unique? (default: false).
  55. * @return int New row ID or 0
  56. */
  57. public function add_metadata( $item_id, $meta_key, $meta_value, $unique = false );
  58. /**
  59. * Delete term meta.
  60. *
  61. * @param int $item_id Item ID.
  62. * @param string $meta_key Meta key.
  63. * @param string $meta_value Meta value (default: '').
  64. * @param bool $delete_all Delete all matching entries? (default: false).
  65. * @return bool
  66. */
  67. public function delete_metadata( $item_id, $meta_key, $meta_value = '', $delete_all = false );
  68. /**
  69. * Get term meta.
  70. *
  71. * @param int $item_id Item ID.
  72. * @param string $key Meta key.
  73. * @param bool $single Store as single value and not serialised (default: true).
  74. * @return mixed
  75. */
  76. public function get_metadata( $item_id, $key, $single = true );
  77. /**
  78. * Get order ID by order item ID.
  79. *
  80. * @param int $item_id Item ID.
  81. * @return int
  82. */
  83. public function get_order_id_by_order_item_id( $item_id );
  84. /**
  85. * Get the order item type based on Item ID.
  86. *
  87. * @param int $item_id Item ID.
  88. * @return string
  89. */
  90. public function get_order_item_type( $item_id );
  91. }