woocommerce/includes/data-stores
Cesar Rodas 38f379a7d7 Make get_item() consistent (like get_items())
Right now get_item() is loading an item from the database directly. It doesn't
take advantage of our cache and it doesn't check if the item is already loaded in memory.

There is also another bug (or feature?) that it will let you load any item, even if the item is not related to the current order. I believe this is a bug, if somebody really wants to load any item regardless of the order they should use `WC_Order_Factory::get_order_item`.

Another bug is that items loaded with get_item() are not related to the order object, therefore any calls to Order::save() won't persist the changes made to the item.

This commits makes sure the item returned by get_item is loaded similarly like get_items() does, taking advantage of the cache and the $items protected property (chances are the item is already in memory, ready to be used).

If a given item is not found false will be returned. If item exists but it is not related to the current object it will return false as well (If this behaviour is wanted, I can easily change it load the item anyways instead of returning false).
2017-04-26 02:54:14 -04:00
..
abstract-wc-order-data-store-cpt.php Make get_item() consistent (like get_items()) 2017-04-26 02:54:14 -04:00
abstract-wc-order-item-type-data-store.php Make sure the changes includes either $name or $order_id 2017-03-28 08:47:01 -04:00
class-wc-coupon-data-store-cpt.php fix coupon update 2017-04-15 21:48:22 +01:00
class-wc-customer-data-store-session.php Set session data only if the value is empty in customer object. Prevents session data overwriting customer data on login. 2017-04-06 10:28:32 +01:00
class-wc-customer-data-store.php woocommerce_update_customer_args filter 2017-04-11 12:47:53 +01:00
class-wc-customer-download-data-store.php Download permissions; Convert dates to timestamp on read so UTC is preserved. 2017-04-11 13:13:03 +01:00
class-wc-data-store-wp.php Miscellaneous cleanup of typos + change some return types for IDE helpers 2017-03-20 11:03:14 +01:00
class-wc-order-data-store-cpt.php wc_get_orders support for guest orders and unit tests 2017-04-20 18:05:58 +01:00
class-wc-order-item-coupon-data-store.php Miscellaneous cleanup of typos + change some return types for IDE helpers 2017-03-20 11:03:14 +01:00
class-wc-order-item-data-store.php Miscellaneous cleanup of typos + change some return types for IDE helpers 2017-03-20 11:03:14 +01:00
class-wc-order-item-fee-data-store.php Miscellaneous cleanup of typos + change some return types for IDE helpers 2017-03-20 11:03:14 +01:00
class-wc-order-item-product-store.php Miscellaneous cleanup of typos + change some return types for IDE helpers 2017-03-20 11:03:14 +01:00
class-wc-order-item-shipping-data-store.php Miscellaneous cleanup of typos + change some return types for IDE helpers 2017-03-20 11:03:14 +01:00
class-wc-order-item-tax-data-store.php Miscellaneous cleanup of typos + change some return types for IDE helpers 2017-03-20 11:03:14 +01:00
class-wc-order-refund-data-store-cpt.php Miscellaneous cleanup of typos + change some return types for IDE helpers 2017-03-20 11:03:14 +01:00
class-wc-payment-token-data-store.php Use prepare on `type` in payment token data store 2017-03-31 11:22:47 +01:00
class-wc-product-data-store-cpt.php Filter invalid products before returning them for wc_get_products 2017-04-25 14:03:30 +01:00
class-wc-product-grouped-data-store-cpt.php Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
class-wc-product-variable-data-store-cpt.php Use get_children for comparison 2017-04-06 19:47:22 +01:00
class-wc-product-variation-data-store-cpt.php Merge pull request #14415 from woocommerce/fix/save-post-infinite-loops 2017-04-20 00:44:57 -03:00
class-wc-shipping-zone-data-store.php Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00