2016-11-18 11:34:02 +00:00
|
|
|
<?php
|
2018-03-06 09:42:03 +00:00
|
|
|
/**
|
|
|
|
* Order Item Data Store Interface
|
|
|
|
*
|
|
|
|
* @version 3.0.0
|
2020-08-05 16:36:24 +00:00
|
|
|
* @package WooCommerce\Interface
|
2018-03-06 09:42:03 +00:00
|
|
|
*/
|
|
|
|
|
2016-11-18 11:34:02 +00:00
|
|
|
/**
|
|
|
|
* WC Order Item Data Store Interface
|
|
|
|
*
|
2016-11-21 19:38:07 +00:00
|
|
|
* Functions that must be defined by the order item data store (for functions).
|
2016-11-18 11:34:02 +00:00
|
|
|
*
|
2017-03-15 16:36:53 +00:00
|
|
|
* @version 3.0.0
|
2016-11-18 11:34:02 +00:00
|
|
|
*/
|
|
|
|
interface WC_Order_Item_Data_Store_Interface {
|
2017-03-20 10:03:14 +00:00
|
|
|
|
2016-11-18 11:34:02 +00:00
|
|
|
/**
|
2016-11-21 19:38:07 +00:00
|
|
|
* Add an order item to an order.
|
2018-03-06 09:42:03 +00:00
|
|
|
*
|
|
|
|
* @param int $order_id Order ID.
|
2017-03-20 10:03:14 +00:00
|
|
|
* @param array $item order_item_name and order_item_type.
|
2017-01-19 17:38:23 +00:00
|
|
|
* @return int Order Item ID
|
2016-11-18 11:34:02 +00:00
|
|
|
*/
|
2016-11-21 19:38:07 +00:00
|
|
|
public function add_order_item( $order_id, $item );
|
2016-11-21 19:45:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Update an order item.
|
2018-03-06 09:42:03 +00:00
|
|
|
*
|
|
|
|
* @param int $item_id Item ID.
|
2017-03-20 10:03:14 +00:00
|
|
|
* @param array $item order_item_name or order_item_type.
|
2016-11-21 19:45:22 +00:00
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function update_order_item( $item_id, $item );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete an order item.
|
2018-03-06 09:42:03 +00:00
|
|
|
*
|
|
|
|
* @param int $item_id Item ID.
|
2016-11-21 19:45:22 +00:00
|
|
|
*/
|
|
|
|
public function delete_order_item( $item_id );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update term meta.
|
2018-03-06 09:42:03 +00:00
|
|
|
*
|
|
|
|
* @param int $item_id Item ID.
|
|
|
|
* @param string $meta_key Meta key.
|
|
|
|
* @param mixed $meta_value Meta value.
|
|
|
|
* @param string $prev_value Previous value (default: '').
|
2016-11-21 19:45:22 +00:00
|
|
|
* @return bool
|
|
|
|
*/
|
2018-03-06 09:42:03 +00:00
|
|
|
public function update_metadata( $item_id, $meta_key, $meta_value, $prev_value = '' );
|
2016-11-21 19:45:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add term meta.
|
2018-03-06 09:42:03 +00:00
|
|
|
*
|
|
|
|
* @param int $item_id Item ID.
|
|
|
|
* @param string $meta_key Meta key.
|
|
|
|
* @param mixed $meta_value Meta value.
|
|
|
|
* @param bool $unique Unique? (default: false).
|
2017-01-19 17:38:23 +00:00
|
|
|
* @return int New row ID or 0
|
2016-11-21 19:45:22 +00:00
|
|
|
*/
|
2018-03-06 09:42:03 +00:00
|
|
|
public function add_metadata( $item_id, $meta_key, $meta_value, $unique = false );
|
2016-11-21 19:45:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete term meta.
|
2018-03-06 09:42:03 +00:00
|
|
|
*
|
|
|
|
* @param int $item_id Item ID.
|
|
|
|
* @param string $meta_key Meta key.
|
|
|
|
* @param string $meta_value Meta value (default: '').
|
|
|
|
* @param bool $delete_all Delete all matching entries? (default: false).
|
2016-11-21 19:45:22 +00:00
|
|
|
* @return bool
|
|
|
|
*/
|
2018-03-06 09:42:03 +00:00
|
|
|
public function delete_metadata( $item_id, $meta_key, $meta_value = '', $delete_all = false );
|
2016-11-21 19:45:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get term meta.
|
2018-03-06 09:42:03 +00:00
|
|
|
*
|
|
|
|
* @param int $item_id Item ID.
|
|
|
|
* @param string $key Meta key.
|
|
|
|
* @param bool $single Store as single value and not serialised (default: true).
|
2016-11-21 19:45:22 +00:00
|
|
|
* @return mixed
|
|
|
|
*/
|
2018-03-06 09:42:03 +00:00
|
|
|
public function get_metadata( $item_id, $key, $single = true );
|
2017-01-18 22:05:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get order ID by order item ID.
|
2018-03-06 09:42:03 +00:00
|
|
|
*
|
|
|
|
* @param int $item_id Item ID.
|
2017-01-18 22:05:50 +00:00
|
|
|
* @return int
|
|
|
|
*/
|
2018-03-06 09:42:03 +00:00
|
|
|
public function get_order_id_by_order_item_id( $item_id );
|
2017-02-08 19:39:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the order item type based on Item ID.
|
2018-03-06 09:42:03 +00:00
|
|
|
*
|
|
|
|
* @param int $item_id Item ID.
|
2017-02-08 19:39:30 +00:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function get_order_item_type( $item_id );
|
2016-11-18 11:34:02 +00:00
|
|
|
}
|