diff --git a/includes/data-stores/abstract-wc-order-data-store-cpt.php b/includes/data-stores/abstract-wc-order-data-store-cpt.php index 9e0a738da4b..67cbebda782 100644 --- a/includes/data-stores/abstract-wc-order-data-store-cpt.php +++ b/includes/data-stores/abstract-wc-order-data-store-cpt.php @@ -220,7 +220,7 @@ abstract class Abstract_WC_Order_Data_Store_CPT extends WC_Data_Store_WP impleme /** * Helper method that updates all the post meta for an order based on it's settings in the WC_Order class. * - * @param WC_Order + * @param $order WC_Order * @since 3.0.0 */ protected function update_post_meta( &$order ) { diff --git a/includes/data-stores/class-wc-customer-download-data-store.php b/includes/data-stores/class-wc-customer-download-data-store.php index 192b0ad3b01..a4a28f512cc 100644 --- a/includes/data-stores/class-wc-customer-download-data-store.php +++ b/includes/data-stores/class-wc-customer-download-data-store.php @@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) { class WC_Customer_Download_Data_Store implements WC_Customer_Download_Data_Store_Interface { /** - * Create dowload permission for a user. + * Create download permission for a user. * * @param WC_Customer_Download $download */ diff --git a/includes/data-stores/class-wc-data-store-wp.php b/includes/data-stores/class-wc-data-store-wp.php index 69fc5734be4..1ccc6e92f4a 100644 --- a/includes/data-stores/class-wc-data-store-wp.php +++ b/includes/data-stores/class-wc-data-store-wp.php @@ -17,7 +17,7 @@ class WC_Data_Store_WP { /** * Meta type. This should match up with - * the types avaiable at https://codex.wordpress.org/Function_Reference/add_metadata. + * the types available at https://codex.wordpress.org/Function_Reference/add_metadata. * WP defines 'post', 'user', 'comment', and 'term'. */ protected $meta_type = 'post'; @@ -97,7 +97,7 @@ class WC_Data_Store_WP { * @since 3.0.0 * @param WC_Data * @param stdClass (containing ->key and ->value) - * @return meta ID + * @return int meta ID */ public function add_meta( &$object, $meta ) { return add_metadata( $this->meta_type, $object->get_id(), $meta->key, $meta->value, false ); diff --git a/includes/data-stores/class-wc-order-data-store-cpt.php b/includes/data-stores/class-wc-order-data-store-cpt.php index 9ab701ac67d..14e1ffac7c4 100644 --- a/includes/data-stores/class-wc-order-data-store-cpt.php +++ b/includes/data-stores/class-wc-order-data-store-cpt.php @@ -240,7 +240,7 @@ class WC_Order_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT implement parent::update_post_meta( $order ); - // If address changed, store concatinated version to make searches faster. + // If address changed, store concatenated version to make searches faster. if ( in_array( 'billing', $updated_props ) || ! metadata_exists( 'post', $id, '_billing_address_index' ) ) { update_post_meta( $id, '_billing_address_index', implode( ' ', $order->get_address( 'billing' ) ) ); } diff --git a/includes/data-stores/class-wc-order-item-coupon-data-store.php b/includes/data-stores/class-wc-order-item-coupon-data-store.php index c2daeb54a4b..ac2780d20ce 100644 --- a/includes/data-stores/class-wc-order-item-coupon-data-store.php +++ b/includes/data-stores/class-wc-order-item-coupon-data-store.php @@ -23,7 +23,7 @@ class WC_Order_Item_Coupon_Data_Store extends Abstract_WC_Order_Item_Type_Data_S * Read/populate data properties specific to this order item. * * @since 3.0.0 - * @param WC_Order_Item $item + * @param WC_Order_Item_Coupon $item */ public function read( &$item ) { parent::read( $item ); @@ -40,7 +40,7 @@ class WC_Order_Item_Coupon_Data_Store extends Abstract_WC_Order_Item_Type_Data_S * Ran after both create and update, so $item->get_id() will be set. * * @since 3.0.0 - * @param WC_Order_Item $item + * @param WC_Order_Item_Coupon $item */ public function save_item_data( &$item ) { $id = $item->get_id(); diff --git a/includes/data-stores/class-wc-order-item-data-store.php b/includes/data-stores/class-wc-order-item-data-store.php index 4ca80262a2c..36bbbaf647a 100644 --- a/includes/data-stores/class-wc-order-item-data-store.php +++ b/includes/data-stores/class-wc-order-item-data-store.php @@ -17,7 +17,7 @@ class WC_Order_Item_Data_Store implements WC_Order_Item_Data_Store_Interface { * * @since 3.0.0 * @param int $order_id - * @param array $item. order_item_name and order_item_type. + * @param array $item order_item_name and order_item_type. * @return int Order Item ID */ public function add_order_item( $order_id, $item ) { @@ -44,7 +44,7 @@ class WC_Order_Item_Data_Store implements WC_Order_Item_Data_Store_Interface { * * @since 3.0.0 * @param int $item_id - * @param array $item. order_item_name or order_item_type. + * @param array $item order_item_name or order_item_type. * @return boolean */ public function update_order_item( $item_id, $item ) { diff --git a/includes/data-stores/class-wc-order-item-fee-data-store.php b/includes/data-stores/class-wc-order-item-fee-data-store.php index 4826e1fb809..6f748dde876 100644 --- a/includes/data-stores/class-wc-order-item-fee-data-store.php +++ b/includes/data-stores/class-wc-order-item-fee-data-store.php @@ -11,6 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) { * @author WooCommerce */ class WC_Order_Item_Fee_Data_Store extends Abstract_WC_Order_Item_Type_Data_Store implements WC_Object_Data_Store_Interface, WC_Order_Item_Type_Data_Store_Interface { + /** * Data stored in meta keys. * @since 3.0.0 @@ -22,7 +23,7 @@ class WC_Order_Item_Fee_Data_Store extends Abstract_WC_Order_Item_Type_Data_Stor * Read/populate data properties specific to this order item. * * @since 3.0.0 - * @param WC_Order_Item $item + * @param WC_Order_Item_Fee $item */ public function read( &$item ) { parent::read( $item ); @@ -41,7 +42,7 @@ class WC_Order_Item_Fee_Data_Store extends Abstract_WC_Order_Item_Type_Data_Stor * Ran after both create and update, so $id will be set. * * @since 3.0.0 - * @param WC_Order_Item $item + * @param WC_Order_Item_Fee $item */ public function save_item_data( &$item ) { $id = $item->get_id(); diff --git a/includes/data-stores/class-wc-order-item-product-store.php b/includes/data-stores/class-wc-order-item-product-store.php index db5a9c9228e..f7f8025b640 100644 --- a/includes/data-stores/class-wc-order-item-product-store.php +++ b/includes/data-stores/class-wc-order-item-product-store.php @@ -11,6 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) { * @author WooCommerce */ class WC_Order_Item_Product_Data_Store extends Abstract_WC_Order_Item_Type_Data_Store implements WC_Object_Data_Store_Interface, WC_Order_Item_Type_Data_Store_Interface, WC_Order_Item_Product_Data_Store_Interface { + /** * Data stored in meta keys. * @since 3.0.0 @@ -22,7 +23,7 @@ class WC_Order_Item_Product_Data_Store extends Abstract_WC_Order_Item_Type_Data_ * Read/populate data properties specific to this order item. * * @since 3.0.0 - * @param WC_Order_Item $item + * @param WC_Order_Item_Product $item */ public function read( &$item ) { parent::read( $item ); @@ -44,7 +45,7 @@ class WC_Order_Item_Product_Data_Store extends Abstract_WC_Order_Item_Type_Data_ * Ran after both create and update, so $id will be set. * * @since 3.0.0 - * @param WC_Order_Item $item + * @param WC_Order_Item_Product $item */ public function save_item_data( &$item ) { $id = $item->get_id(); @@ -68,7 +69,7 @@ class WC_Order_Item_Product_Data_Store extends Abstract_WC_Order_Item_Type_Data_ * Get a list of download IDs for a specific item from an order. * * @since 3.0.0 - * @param WC_Order_Item $item + * @param WC_Order_Item_Product $item * @param WC_Order $order * @return array */ diff --git a/includes/data-stores/class-wc-order-item-shipping-data-store.php b/includes/data-stores/class-wc-order-item-shipping-data-store.php index 745b2f14d5d..48cd5b8c53d 100644 --- a/includes/data-stores/class-wc-order-item-shipping-data-store.php +++ b/includes/data-stores/class-wc-order-item-shipping-data-store.php @@ -11,6 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) { * @author WooCommerce */ class WC_Order_Item_Shipping_Data_Store extends Abstract_WC_Order_Item_Type_Data_Store implements WC_Object_Data_Store_Interface, WC_Order_Item_Type_Data_Store_Interface { + /** * Data stored in meta keys. * @since 3.0.0 @@ -22,7 +23,7 @@ class WC_Order_Item_Shipping_Data_Store extends Abstract_WC_Order_Item_Type_Data * Read/populate data properties specific to this order item. * * @since 3.0.0 - * @param WC_Order_Item $item + * @param WC_Order_Item_Shipping $item */ public function read( &$item ) { parent::read( $item ); @@ -40,7 +41,7 @@ class WC_Order_Item_Shipping_Data_Store extends Abstract_WC_Order_Item_Type_Data * Ran after both create and update, so $id will be set. * * @since 3.0.0 - * @param WC_Order_Item $item + * @param WC_Order_Item_Shipping $item */ public function save_item_data( &$item ) { $id = $item->get_id(); diff --git a/includes/data-stores/class-wc-order-item-tax-data-store.php b/includes/data-stores/class-wc-order-item-tax-data-store.php index 17ef18441e9..5619143ddc5 100644 --- a/includes/data-stores/class-wc-order-item-tax-data-store.php +++ b/includes/data-stores/class-wc-order-item-tax-data-store.php @@ -11,6 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) { * @author WooCommerce */ class WC_Order_Item_Tax_Data_Store extends Abstract_WC_Order_Item_Type_Data_Store implements WC_Object_Data_Store_Interface, WC_Order_Item_Type_Data_Store_Interface { + /** * Data stored in meta keys. * @since 3.0.0 @@ -22,7 +23,7 @@ class WC_Order_Item_Tax_Data_Store extends Abstract_WC_Order_Item_Type_Data_Stor * Read/populate data properties specific to this order item. * * @since 3.0.0 - * @param WC_Order_Item $item + * @param WC_Order_Item_Tax $item */ public function read( &$item ) { parent::read( $item ); @@ -42,7 +43,7 @@ class WC_Order_Item_Tax_Data_Store extends Abstract_WC_Order_Item_Type_Data_Stor * Ran after both create and update, so $id will be set. * * @since 3.0.0 - * @param WC_Order_Item $item + * @param WC_Order_Item_Tax $item */ public function save_item_data( &$item ) { $id = $item->get_id(); diff --git a/includes/data-stores/class-wc-order-refund-data-store-cpt.php b/includes/data-stores/class-wc-order-refund-data-store-cpt.php index 2c44bb15fed..2a299064124 100644 --- a/includes/data-stores/class-wc-order-refund-data-store-cpt.php +++ b/includes/data-stores/class-wc-order-refund-data-store-cpt.php @@ -35,7 +35,7 @@ class WC_Order_Refund_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT im /** * Delete a refund - no trash is supported. - * @param WC_Order + * @param WC_Order $order * @param array $args Array of args to pass to the delete method. */ public function delete( &$order, $args = array() ) { @@ -49,7 +49,7 @@ class WC_Order_Refund_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT im /** * Read refund data. Can be overridden by child classes to load other props. * - * @param WC_Order + * @param WC_Order $refund * @param object $post_object * @since 3.0.0 */ @@ -67,7 +67,7 @@ class WC_Order_Refund_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT im * Helper method that updates all the post meta for an order based on it's settings in the WC_Order class. * * @param WC_Order - * @param bool $force Force all props to be written even if not changed. This is used during creation. + * @param WC_Order $refund * @since 3.0.0 */ protected function update_post_meta( &$refund ) { diff --git a/includes/interfaces/class-wc-order-item-data-store-interface.php b/includes/interfaces/class-wc-order-item-data-store-interface.php index 5e61798fd91..751bb5d1125 100644 --- a/includes/interfaces/class-wc-order-item-data-store-interface.php +++ b/includes/interfaces/class-wc-order-item-data-store-interface.php @@ -13,10 +13,11 @@ if ( ! defined( 'ABSPATH' ) ) { * @author WooCommerce */ interface WC_Order_Item_Data_Store_Interface { + /** * Add an order item to an order. * @param int $order_id - * @param array $item. order_item_name and order_item_type. + * @param array $item order_item_name and order_item_type. * @return int Order Item ID */ public function add_order_item( $order_id, $item ); @@ -24,7 +25,7 @@ interface WC_Order_Item_Data_Store_Interface { /** * Update an order item. * @param int $item_id - * @param array $item. order_item_name or order_item_type. + * @param array $item order_item_name or order_item_type. * @return boolean */ public function update_order_item( $item_id, $item ); diff --git a/includes/wc-order-item-functions.php b/includes/wc-order-item-functions.php index 368008ed1bb..a325c311d58 100644 --- a/includes/wc-order-item-functions.php +++ b/includes/wc-order-item-functions.php @@ -20,9 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) { * @return mixed */ function wc_add_order_item( $order_id, $item ) { - $order_id = absint( $order_id ); - - if ( ! $order_id ) + if ( ! $order_id = absint( $order_id ) ) return false; $defaults = array( @@ -69,13 +67,13 @@ function wc_update_order_item( $item_id, $args ) { * @return bool */ function wc_delete_order_item( $item_id ) { - $item_id = absint( $item_id ); - $data_store = WC_Data_Store::load( 'order-item' ); - if ( ! $item_id ) { + if ( ! $item_id = absint( $item_id ) ) { return false; } + $data_store = WC_Data_Store::load( 'order-item' ); + do_action( 'woocommerce_before_delete_order_item', $item_id ); $data_store->delete_order_item( $item_id );