commit
525ea24160
|
@ -15,7 +15,9 @@ defined( 'ABSPATH' ) || exit;
|
|||
*
|
||||
* @param int $order_id Order ID.
|
||||
* @param array $item_array Items list.
|
||||
* @return int|bool Item ID or false
|
||||
*
|
||||
* @throws Exception When `WC_Data_Store::load` validation fails.
|
||||
* @return int|bool Item ID or false
|
||||
*/
|
||||
function wc_add_order_item( $order_id, $item_array ) {
|
||||
$order_id = absint( $order_id );
|
||||
|
@ -45,6 +47,8 @@ function wc_add_order_item( $order_id, $item_array ) {
|
|||
* @since 2.2
|
||||
* @param int $item_id Item ID.
|
||||
* @param array $args Either `order_item_type` or `order_item_name`.
|
||||
*
|
||||
* @throws Exception When `WC_Data_Store::load` validation fails.
|
||||
* @return bool True if successfully updated, false otherwise.
|
||||
*/
|
||||
function wc_update_order_item( $item_id, $args ) {
|
||||
|
@ -63,7 +67,9 @@ function wc_update_order_item( $item_id, $args ) {
|
|||
/**
|
||||
* Delete an item from the order it belongs to based on item id.
|
||||
*
|
||||
* @param int $item_id Item ID.
|
||||
* @param int $item_id Item ID.
|
||||
*
|
||||
* @throws Exception When `WC_Data_Store::load` validation fails.
|
||||
* @return bool
|
||||
*/
|
||||
function wc_delete_order_item( $item_id ) {
|
||||
|
@ -91,6 +97,8 @@ function wc_delete_order_item( $item_id ) {
|
|||
* @param string $meta_key Meta key.
|
||||
* @param string $meta_value Meta value.
|
||||
* @param string $prev_value Previous value (default: '').
|
||||
*
|
||||
* @throws Exception When `WC_Data_Store::load` validation fails.
|
||||
* @return bool
|
||||
*/
|
||||
function wc_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value = '' ) {
|
||||
|
@ -109,6 +117,8 @@ function wc_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_valu
|
|||
* @param string $meta_key Meta key.
|
||||
* @param string $meta_value Meta value.
|
||||
* @param bool $unique If meta data should be unique (default: false).
|
||||
*
|
||||
* @throws Exception When `WC_Data_Store::load` validation fails.
|
||||
* @return int New row ID or 0.
|
||||
*/
|
||||
function wc_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = false ) {
|
||||
|
@ -129,6 +139,8 @@ function wc_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = fal
|
|||
* @param string $meta_key Meta key.
|
||||
* @param string $meta_value Meta value (default: '').
|
||||
* @param bool $delete_all Delete all meta data, defaults to `false`.
|
||||
*
|
||||
* @throws Exception When `WC_Data_Store::load` validation fails.
|
||||
* @return bool
|
||||
*/
|
||||
function wc_delete_order_item_meta( $item_id, $meta_key, $meta_value = '', $delete_all = false ) {
|
||||
|
@ -146,6 +158,8 @@ function wc_delete_order_item_meta( $item_id, $meta_key, $meta_value = '', $dele
|
|||
* @param int $item_id Item ID.
|
||||
* @param string $key Meta key.
|
||||
* @param bool $single Whether to return a single value. (default: true).
|
||||
*
|
||||
* @throws Exception When `WC_Data_Store::load` validation fails.
|
||||
* @return mixed
|
||||
*/
|
||||
function wc_get_order_item_meta( $item_id, $key, $single = true ) {
|
||||
|
@ -157,6 +171,8 @@ function wc_get_order_item_meta( $item_id, $key, $single = true ) {
|
|||
* Get order ID by order item ID.
|
||||
*
|
||||
* @param int $item_id Item ID.
|
||||
*
|
||||
* @throws Exception When `WC_Data_Store::load` validation fails.
|
||||
* @return int
|
||||
*/
|
||||
function wc_get_order_id_by_order_item_id( $item_id ) {
|
||||
|
|
Loading…
Reference in New Issue