Commit Graph

1410 Commits

Author SHA1 Message Date
Claudio Sanches 94b0800735 Use CRUD Controller for product variations 2017-02-16 22:51:36 -02:00
Claudio Sanches 55977d03f3 Do not allow manipulate variations on products endpoint 2017-02-16 22:51:24 -02:00
Claudio Sanches 63cb7e7c27 Use CRUD Controller for products 2017-02-16 22:26:21 -02:00
Claudio Sanches 31f68377f9 Fixed docblock 2017-02-16 22:25:20 -02:00
Claudio Sanches 197d2eb98e Use CRUD Controller for order refunds 2017-02-16 21:45:12 -02:00
Claudio Sanches 687433d5cc Use CRUD Controller for orders 2017-02-16 21:15:34 -02:00
Claudio Sanches 34cf70407e Use CRUD Controller for coupons 2017-02-16 20:31:36 -02:00
Claudio Sanches 7a52ec465b Fixed docblocks and removed dead variables 2017-02-16 18:05:06 -02:00
Claudio Sanches 9c15ca936b Merge pull request #13206 from woocommerce/rest-api-v2
REST API v2
2017-02-16 12:53:46 -02:00
Claudio Sanches f08c10d068 Fixed and improved the variations endpoint 2017-02-16 03:07:51 -02:00
Claudio Sanches e48243aa0b No private methods in REST API 2017-02-16 02:30:04 -02:00
Claudio Sanches 666d1f3c06 Prevent PHP notices while saving meta_data without an id 2017-02-16 01:44:45 -02:00
Claudio Sanches 75b2661ba3 Fixed undefined $meta[id] 2017-02-16 01:42:47 -02:00
Claudio Sanches 036a2f6c92 Allow save meta data for products in v2 2017-02-16 01:39:30 -02:00
Claudio Sanches d2818be2ba Order refunds v1 and v2 2017-02-16 01:27:44 -02:00
Claudio Sanches a19fa78cef Fixed orders get_collection_params() 2017-02-16 01:10:41 -02:00
Claudio Sanches 5ebeafac33 Removed duplicated code 2017-02-16 01:09:36 -02:00
Claudio Sanches eaf492a7f1 Fixed orders v2 schema 2017-02-16 01:08:02 -02:00
Claudio Sanches 503812971d Fixed deprecated warnings in orders v1 2017-02-16 00:45:20 -02:00
Claudio Sanches 5c0046b325 Do not allow save meta_data in orders v1 2017-02-16 00:33:17 -02:00
Claudio Sanches cc1992f1c8 Fixed item variation_id 2017-02-16 00:26:42 -02:00
Claudio Sanches 2d0a479750 Updated v1 methods 2017-02-16 00:22:15 -02:00
Claudio Sanches bad93d4c86 Improved naming for meta_data in schema 2017-02-15 12:28:45 -02:00
Claudio Sanches 0dac5e596c Included meeta data to products 2017-02-14 14:01:31 -02:00
Claudio Sanches ad3716a49e Fixed coupons schema 2017-02-14 13:59:22 -02:00
Claudio Sanches 5365fec1b3 V1 and V2 for products endpoint 2017-02-13 19:44:27 -02:00
Claudio Sanches d02d90c867 V1 and V2 for product taxonomies, reviews, reports, taxes and webhooks 2017-02-11 12:51:41 -02:00
Claudio Sanches e9f2e75d53 Fixed coding standards and file header 2017-02-11 12:51:13 -02:00
Claudio Sanches 190ebccd00 Fixed order notes 2017-02-10 21:34:01 -02:00
Claudio Sanches 7f82051dd9 Fixed returning values in write context 2017-02-10 21:32:40 -02:00
Claudio Sanches ca67d448a2 Fixed doing it wrong notices 2017-02-10 21:11:56 -02:00
Claudio Sanches e84acf3ee4 Order notes v2 2017-02-10 18:31:29 -02:00
Claudio Sanches e4b6c81f66 Customer downloads v2 2017-02-10 18:31:21 -02:00
Claudio Sanches b1b536b5d2 Give REST API authentication a lower priority
Bigger than add_filter( 'determine_current_user', 'wp_validate_auth_cookie' );
Smaller than add_filter( 'determine_current_user', 'wp_validate_logged_in_cookie', 20
);

This solve issues while trying to authenticate in a browser while logged
in.

Closes #13134
2017-02-10 15:35:52 -02:00
Claudio Sanches ec8fe6e30d [REST API] Implement CRUD to customers 2017-02-09 19:54:16 -02:00
Claudio Sanches 23fbc31dfb [REST API v1] Implement CRUD to coupons 2017-02-09 19:22:19 -02:00
Claudio Sanches 5d87a28407 Restored shipping zones base controller 2017-02-09 18:46:57 -02:00
Claudio Sanches 88d2875514 Restored REST API v1 2017-02-09 18:40:35 -02:00
Claudio Sanches 4352484ed7 REST API v2 2017-02-09 15:06:13 -02:00
Mike Jolley c49368f7fc Small id fix for #13118 2017-02-08 18:19:24 +00:00
Claudio Sanches 9b0a4e6c92 Merge pull request #13109 from woocommerce/fix-regressed-tests
Fix failing tests and array_merge error
2017-02-08 16:18:08 -02:00
Claudio Sanches 4e653139b6 Merge pull request #13117 from woocommerce/fix-12973
Moved refund logic
2017-02-08 16:15:54 -02:00
Mike Jolley 3cf772bcb5 Always use type arg 2017-02-08 18:08:13 +00:00
Mike Jolley eb150724c4 Make sure calculations are redone after setting line items
Closes #13075
2017-02-08 17:23:40 +00:00
Mike Jolley 11ef37880b Moved logic to wc_create_refund 2017-02-08 16:20:42 +00:00
Mike Jolley 52291e003c wrong method name 2017-02-08 16:20:05 +00:00
Mike Jolley af6ee6d420 Fix; wrong method calls 2017-02-08 16:19:13 +00:00
Claudiu Lodromanean 173c09dd04 Fix failing tests and array_merge error 2017-02-07 10:46:03 -08:00
Claudio Sanches 79256504a1 [REST API] Products endpoint fixes, closes #13031 2017-02-01 09:58:04 +01:00
Claudio Sanches 346e1ea1e0 Merge pull request #12996 from woocommerce/rest-api-missing-types-args
REST API Types
2017-01-27 14:49:35 -02:00
Claudio Sanches 24a5fe7592 Make WC_REST_Exception extend WC_Data_Exception 2017-01-27 13:52:21 -02:00
Toni Viemerö 2d92bdece6 Cast position as integer
Even though I'm sending `position` as integer in my REST request, it comes through as string value.

```
array (
  'id' => '186',
  'position' => '0',
)
```
2017-01-26 23:08:12 +02:00
Mike Jolley e930ccd16e object types to fix unit tests 2017-01-26 20:58:55 +00:00
Toni Viemerö 2b00615fa2 Remove tilde from i 2017-01-26 22:55:23 +02:00
Mike Jolley 82d7fe6e73 Added more missing args and types 2017-01-26 20:33:39 +00:00
Mike Jolley b727c61da7 Missing arg and setting types 2017-01-26 20:06:18 +00:00
Mike Jolley 2d23705431 ID arg definitions 2017-01-26 19:22:57 +00:00
Mike Jolley def35a5aa2 Cast request ids to int 2017-01-26 18:34:11 +00:00
Justin Shreve 474a307420 Introduce get_tax_class_slugs. 2017-01-25 13:38:13 -08:00
Claudio Sanches cdf59d6f68 E[REST API] Use WC_Data_Exception->getErrorData 2017-01-23 17:32:33 -02:00
Claudio Sanches f54e9e1e1a Fixed coding standards 2017-01-18 15:16:01 -02:00
Mike Jolley d92447713a Merge pull request #12852 from woocommerce/fix-terms-ordering
Restore attributes ordering
2017-01-17 12:28:41 +00:00
Claudio Sanches bd655af072 Restore attributes ordering, closes #12847 2017-01-16 21:11:56 -02:00
Claudio Sanches 3d352a680c [REST API] Allow search by multiples SKUs 2017-01-16 20:35:55 -02:00
matttallan c45d81e650 Make the system_status GET endpoint more customisable 2017-01-10 16:06:09 +10:00
Justin Shreve 291a662be1 The WC API returns exclude_product_ids and expiry_date. 2.7 renamed these in the API file, which we should not do until we version the endpoints. 2017-01-03 10:25:36 -08:00
Mike Jolley fc867c1a58 Return current variations after API update/create 2017-01-03 16:53:49 +00:00
Mike Jolley 859727d462 Merge pull request #12678 from franticpsyx/rest-api-set-order-item-action
[2.7] Add 'woocommerce_rest_set_order_item' REST API hook
2016-12-23 14:18:31 +00:00
Manos Psychogyiopoulos 42e09eac32 make rest api order item totals - always excl tax 2016-12-22 19:23:07 +02:00
Manos Psychogyiopoulos 0d6eae5fca add 'woocommerce_rest_set_order_item' hook 2016-12-22 17:56:14 +02:00
Mike Jolley 8f49724b17 Merge pull request #12674 from franticpsyx/rest-api-set-order-item-meta
[2.7] REST order item meta not intercepted
2016-12-22 14:38:39 +00:00
Mike Jolley 6861131d8f Fix version check 2016-12-22 14:30:47 +00:00
Manos Psychogyiopoulos dae45b8a29 fix paren position 2016-12-22 14:10:36 +02:00
Manos Psychogyiopoulos 6fc59cf2dc set REST order item meta 2016-12-22 12:29:57 +02:00
Mike Jolley 020a7b518f Fix API set of reviews_allowed
#12618
2016-12-16 11:24:11 +00:00
Claudio Sanches af52cf4f73 [2.6] [REST API] Throw exception when product image ID is not a valid attachment 2016-12-14 21:11:50 -02:00
Justin Shreve da1e14c087 Add WC CLI commands powered by the REST API. 2016-12-08 10:59:07 -08:00
Mike Jolley 4bacbaf90c Fix completed and paid date meta keys. 2016-12-08 11:19:32 +00:00
Mike Jolley 47fbae4d26 Product Visibility Taxonomies (#12527)
* Convert visibility and featured to taxonomy

* Comment

* Add missing tax_queries

* Only check SKU after read.

* Added visibility term for outofstock products to speed those queries up al

* wc_bool_to_string
2016-12-08 10:56:45 +00:00
Justin Shreve 63a29dd4db Add 'locale' to list of customer meta keys, and update expected type for 'object' for gateways, products, and shipping zones to fix some API issues. 2016-12-07 12:23:23 -08:00
Mike Jolley e8d119c42c Feedback 2016-12-07 18:13:17 +00:00
Mike Jolley 1ad852443b Invalid type 2016-12-07 15:54:35 +00:00
Mike Jolley 7f234a0b63 Update array schema 2016-12-07 14:24:44 +00:00
Mike Jolley cce08e6225 Indenting 2016-12-07 14:06:04 +00:00
Mike Jolley d4fbda1d68 Put back array for arrays of objects 2016-12-07 12:20:56 +00:00
Mike Jolley ba62599da0 Use objects, rather than arrays in schema when properties are defined 2016-12-07 11:36:46 +00:00
Mike Jolley ff05080208 Merge pull request #12462 from danielhuesken/fix_rest_setting_user_role
Set customer role for user if it not a customer on the current blog
2016-12-06 11:16:27 +00:00
Mike Jolley a8f6fd88f4 Merge pull request #12488 from woocommerce/save-coupon-wp-error
When saving coupons, return wp_error if necessary
2016-12-01 16:21:23 +00:00
Justin Shreve a94acad387 Fix title, enabled, and description updates for payment gateways. Add missing readonly on method title and description.
Bump WC version.
2016-11-29 11:57:56 -08:00
Justin Shreve 5d8ce22afe When saving coupons, return wp_errors if an item cannot be created or updated. 2016-11-29 03:06:10 -08:00
Mike Jolley 169c70f447 Fix get_stock_amount 2016-11-25 14:48:20 +00:00
Mike Jolley e3f19f85c6 Add readonly role field to API
Closes #12468 @claudiosanches
2016-11-25 13:04:21 +00:00
Daniel Hüsken 89026327b8 Set customer role for user if it not a customer on the current blog 2016-11-24 13:52:54 +01:00
Mike Jolley badd63bdd9 Merge pull request #12448 from woocommerce/webhook-api-versions
Allow send webhook payload using legacy API v3 or WP REST API integration
2016-11-24 10:22:01 +00:00
Mike Jolley 4ca49ba999 Fix tests 2016-11-23 16:27:18 +00:00
Mike Jolley d7dfdd3d10 Wrap all deprecation calls. 2016-11-23 16:15:00 +00:00
Claudio Sanches 7aafd6cce7 Set webhook API version in REST API 2016-11-22 22:01:16 -02:00
Mike Jolley deec278d4a Only update menu order and display if set.
Closes #12411
2016-11-22 15:50:35 +00:00
Mike Jolley 277d9db832 Fix coupon unit test 2016-11-22 13:59:08 +00:00
Justin Shreve c83823b97c Remove stray error_log 2016-11-22 03:39:26 -08:00
Justin Shreve afa294e70d Fix legacy API issues 2016-11-21 10:57:33 -08:00
Justin Shreve b20b3590c8 First pass at order items 2016-11-21 10:56:21 -08:00
Claudio Sanches ec56bd5015 Merge pull request #12386 from woocommerce/order-data-store
Order data stores
2016-11-21 15:14:22 -02:00
Mike Jolley 32de28355a Merge branch 'master' into order-data-store
# Conflicts:
#	includes/admin/meta-boxes/class-wc-meta-box-order-data.php
2016-11-21 14:45:46 +00:00
Claudio Sanches 2739243587 Use wc_get_coupon_id_by_code() while querying coupons by code 2016-11-18 17:12:01 -02:00
Claudio Sanches 40c90ac2d0 Use ID to query coupons 2016-11-18 17:10:41 -02:00
Claudio Sanches dd3a59d169 Return empty prices for deprecated cart_discount and order_discount in order legacy v1 2016-11-18 17:06:33 -02:00
Claudio Sanches fdb0cf499f Query coupons only by ID 2016-11-18 16:51:45 -02:00
Claudio Sanches 7a6bc5f9f5 Removed extra get_post() for orders 2016-11-18 16:46:59 -02:00
Claudio Sanches a8a5763b47 Removed extra ) 2016-11-18 16:39:31 -02:00
Claudio Sanches 073c924b98 Stop doing new queries only to get coupons gmt dates 2016-11-18 16:36:02 -02:00
Claudio Sanches 3074bd180f Apply GMT date for legacy v1 customers endpoint 2016-11-18 16:34:30 -02:00
Claudio Sanches 359e0a5a56 Use GMT dates in legacy API 2016-11-18 16:33:16 -02:00
Claudio Sanches 526a46325f Allow convert date to GMT in the legacy API 2016-11-18 16:13:46 -02:00
Claudio Sanches 6d66391a68 Merge pull request #12388 from woocommerce/terms-performance
Optimize terms queries
2016-11-18 13:01:38 -02:00
Mike Jolley da2cc7144c Merge pull request #12396 from woocommerce/update-customer-crud-endpoints
Apply Customer CRUD to legacy customer API endpoint
2016-11-18 12:35:24 +00:00
Mike Jolley 5d9a9b4dec Fix tests 2016-11-18 11:14:09 +00:00
Claudio Sanches 65c9a1b26b Fixed undefined method WC_Order_Item_Product::get_qty() 2016-11-18 06:08:00 -02:00
Claudio Sanches 91d6c74701 Apply Customer CRUD methods to update and create legacy API endpoints 2016-11-18 04:16:38 -02:00
Claudio Sanches e032001953 Fixed undefined variable on update_customer_meta_fields() 2016-11-18 03:37:59 -02:00
Claudio Sanches 4fd47e1b02 Use wc_get_orders() to query customer orders 2016-11-17 22:11:05 -02:00
Claudio Sanches aba4699ee2 Removed old get avatar method 2016-11-17 22:01:55 -02:00
Claudio Sanches 14996ef97a Updated customer legacy API endpoints 2016-11-17 21:55:52 -02:00
Claudio Sanches e1aeba9f21 Remove all wp_get_post_terms() and wp_get_object_terms() terms occurrences 2016-11-17 17:02:05 -02:00
Justin Shreve 20fca44334 Handle product quick and bulk edit. 2016-11-16 12:54:53 -08:00
Mike Jolley ecc503c2c7 Merge branch 'product-crud-test-fixes'
# Conflicts:
#	includes/class-wc-data-store.php
#	woocommerce.php
2016-11-16 15:09:32 +00:00
Justin Shreve 85cfe59988 Fix product related tests after product CRUD merge 2016-11-16 05:18:03 -08:00
Mike Jolley 76b32c9aa5 WIP - Product CRUD (#12065)
* Created function to get the catalog visibility options

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* Hardcode the get_type per product class

* Initial look through getters and setters and abstract data

* Missing var

* Add related product functions and deprecate those in class.

* No need to exclude ID

* Fixed coding standards and improved the docblocks

* Get cached terms from wc_get_related_terms()

* Fixed wrong variable in wc_get_related_terms

* Use count() instead of sizeof()

* Sanitize ids later

* Remove unneeded comments

* wc_get_product_term_ids instead of related wording and use in other places.

get_the_terms is used here and also handles caching, something
wp_get_post_terms does not.

* Clean up the abstract product class a bit, deprecate two functions we have renamed, make update & create work properly, and add some tests for it.

* Bump template version

* Handle PR feedback: Remove duplicate regular_price update, allow changing of post status for products, remove deprecation for get_title since we might still offer it as a function

* Made abstract function useful

* External Product CRUD

* _virtual meta should be 'no', not taxable, in product unit test helper

* Grouped product class

* Tests

* Move children to meta and update test

* Use get_upsell_ids

* Spacing in query

* Moving and refactoring methods

* Availability html

* Tidy/add todos

* Rename method

* Put back review functions (still todo)

* missing $this

* get_price_including_tax/excluding_tax functions

* wc_get_price_to_display

* Price handling

* [Product CRUD] Variable (#12146)

* [Product CRUD] Variable Products

* Handle PR feedback.

* [Product CRUD] Grouped Handling (#12151)

* Handle grouped product saving

* Update routine

* [Product CRUD] Product crud terms (#12149)

* Category and tag id handling

* Replace template functions

* Remove todo

* Handle default name in save function

* Product crud admin save routine (#12174)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Spacing

* Fix comment

* wc_implode_text_attributes helper function

* [Product CRUD] Product crud admin use getters (#12196)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Move settings into new files

* Refactor panels and use getters

* Use getters for variation panel

* Revert save variation changes for now

* Add todos

* Fix downloads

* REST API CRUD Updates

* Additional API updates/fixes. Added some todos

* Fix final failing tests and implementing setters/getters and attributes functionality.

* Fix comparison for is_on_sale and remove download_type from WC_Product.

* Add a wc_get_products wrapper.

* Remove the download type input from the product data metabox for downloadable products. (#12221)

* [Product CRUD] Variations - setters, getters and admin. (#12228)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes

* Implement CRUD in the legacy REST API

* Handle PR feedback

* [Product CRUD] Getter setter proxy methods (#12236)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* get_prop implementation in abstract and data classes

* Implement set_prop

* Change handling

* Array key exists

* set_object_read

* Use get_the_terms() instead of wp_get_post_terms()

wp_get_post_terms() is a wrapper around wp_get_object_terms() which does not
use the object cache, and generates a database query every time it is used.

get_the_terms() however can use data from the object cache if present.

* Allow WP_Query to preload post data, and meta in wc_get_products()

Allow WP_Query to bulk query for post data and meta if more than
just IDs are requested from wc_get_products(). Reduces query count
significantly.

* [Product CRUD] Variable, variation, notices, and stock handling (#12277)

* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* Hardcode the get_type per product class

* Initial look through getters and setters and abstract data

* Missing var

* Fixed coding standards and improved the docblocks

* Get cached terms from wc_get_related_terms()

* Fixed wrong variable in wc_get_related_terms

* Use count() instead of sizeof()

* Add related product functions and deprecate those in class.

* No need to exclude ID

* Sanitize ids later

* Clean up the abstract product class a bit, deprecate two functions we have renamed, make update & create work properly, and add some tests for it.

* Remove unneeded comments

* wc_get_product_term_ids instead of related wording and use in other places.

get_the_terms is used here and also handles caching, something
wp_get_post_terms does not.

* Handle PR feedback: Remove duplicate regular_price update, allow changing of post status for products, remove deprecation for get_title since we might still offer it as a function

* External Product CRUD

* _virtual meta should be 'no', not taxable, in product unit test helper

* Bump template version

* Made abstract function useful

* Grouped product class

* Tests

* Move children to meta and update test

* Use get_upsell_ids

* Spacing in query

* Moving and refactoring methods

* Availability html

* Tidy/add todos

* Rename method

* Put back review functions (still todo)

* missing $this

* get_price_including_tax/excluding_tax functions

* wc_get_price_to_display

* Price handling

* [Product CRUD] Variable (#12146)

* [Product CRUD] Variable Products

* Handle PR feedback.

* [Product CRUD] Grouped Handling (#12151)

* Handle grouped product saving

* Update routine

* [Product CRUD] Product crud terms (#12149)

* Category and tag id handling

* Replace template functions

* Remove todo

* Handle default name in save function

* Product crud admin save routine (#12174)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Spacing

* Fix comment

* wc_implode_text_attributes helper function

* [Product CRUD] Product crud admin use getters (#12196)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Move settings into new files

* Refactor panels and use getters

* Use getters for variation panel

* Revert save variation changes for now

* Add todos

* Fix downloads

* REST API CRUD Updates

* Additional API updates/fixes. Added some todos

* Fix final failing tests and implementing setters/getters and attributes functionality.

* Fix comparison for is_on_sale and remove download_type from WC_Product.

* Add a wc_get_products wrapper.

* Remove the download type input from the product data metabox for downloadable products. (#12221)

* [Product CRUD] Variations - setters, getters and admin. (#12228)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes

* Implement CRUD in the legacy REST API

* Handle PR feedback

* [Product CRUD] Getter setter proxy methods (#12236)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* get_prop implementation in abstract and data classes

* Implement set_prop

* Change handling

* Array key exists

* set_object_read

* Use get_the_terms() instead of wp_get_post_terms()

wp_get_post_terms() is a wrapper around wp_get_object_terms() which does not
use the object cache, and generates a database query every time it is used.

get_the_terms() however can use data from the object cache if present.

* [Product CRUD] Variable, variation, notices, and stock handling (#12277)

* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback

* Prevent notices

* Handle image_id from parent

* Fix error

* Remove _wc_save_product_price

* Remove todo

* Fixed wrong variation URLs

* Fixed undefined $image_id in WC_Product_Variation::get_image_id()

* Allow wc_rest_prepare_date_response() handle timestamps

* Updated get methods on REST API for variations

* Use variations CRUD to save variations metadata

* [Product CRUD] Abstract todos (#12305)

* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback

* Revert "[Product CRUD] Abstract todos (#12305)"

This reverts commit 9a6136fcf8.

* Remove deprecated get_variation_id()

* New default attributes method

* [Product CRUD] Product Datastore (#12317)

* Fix up tests in the product/* folder.

* Handle data store updates for grouped, variable, external, simple, and general data store updates for products.

* Variations & variable changes.

* Update -functions.php calls to use data store.

* Add an interface for the public product data store methods.

* Finished product factory tests

* Correctly delete in the api, fix up some comments, and implement an interface for the public variable methods.

* Fix up delete in all versions of the api

* Handle feedback

* Match protected decloration to parent

* Product crud abstract todos (#12316)

* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback

* Fix up store

* Fixed method returning in write context

* Fix error in variation admin

* Check for parent value - fixes tax class

* Remove old/complete todos

* Allow set tax class as "parent"

* Removed duplicated sync

* Fixed wrong variation URLs

* Fixed undefined $image_id in WC_Product_Variation::get_image_id()

* Allow wc_rest_prepare_date_response() handle timestamps

* Updated get methods on REST API for variations

* Use variations CRUD to save variations metadata

* Remove deprecated get_variation_id()

* New default attributes method

* Fixed method returning in write context

* Allow set tax class as "parent"

* Removed duplicated sync

* Fixed coding standards

* TODO is not accurate.

* Should pass WC_Product instancies to WC_Comments methods (#12327)

* Use new method in abstract order class to prevent headers sent issue in tests

* Fixed variable description in REST API

* Updated how create initial product variation

* Fixed a few fatal errors and warnings in Products CRUD (#12329)

* Fixed a few fatal errors and warnings in Products CRUD

* Fixed sync functions

* Add variations CRUD to legacy API (#12331)

* Apply crud to variable products in legacy API v1

* New REST API do not need fallback for default attributes

* Apply variations CRUD to legacy API v2

* Legacy v2 - save default attributes

* Variations in legacy API v2 do not have descriptions

* Fixed legacy API v2 variations params

* Applied variations CRUD to legacy API v3

* Sync before save in legacy apis

* Punc

* Removed API todos

* Removed test

* Products endpoint tweaks (#12354)

* Var type already normalized on CRUD

* Let Product CRUD handle with validation, sanitization and conditional checks

* Set downloads using WC_Product_Download

* Stop try catch exceptions more than one time

* Handle WC_Data_Exception in legacy API

* Complete remove products when fails on creating

* On creating I mean!

* Already have a method to complete delete products

* Fixed standards using WP CodeSniffer

* get_the_terms() returns false when empty

* get_manage_stock returns boolean

@claudiosanches

* Merge conflict

* Variations API endpoint fixes

* Product CRUD improvements (#12359)

* args is not used any more - remove todo

* Added test for attributes

* wc_get_price_excluding_tax usage

* parent usage

* Fix rating counts

* Test fixes

* Cleanup after tests

* Make sure status transition code runs even during API calls, not just in admin.

* Default visibility

* Fix attribute setting in API

* Use get name instead of get title

* variation id usage

* Improved cross sell templates

* variation_data

* Grouped product sync

* Notices

* Sync is not needed in API

* Delete

* Rename interfaces

* Update counts in data store
2016-11-16 12:38:24 +00:00
Mike Jolley af3496402d Merge branch 'master' into product-crud
# Conflicts:
#	includes/class-wc-data-store.php
#	woocommerce.php
2016-11-16 12:37:57 +00:00
Mike Jolley 599a2ad296 Product CRUD improvements (#12359)
* args is not used any more - remove todo

* Added test for attributes

* wc_get_price_excluding_tax usage

* parent usage

* Fix rating counts

* Test fixes

* Cleanup after tests

* Make sure status transition code runs even during API calls, not just in admin.

* Default visibility

* Fix attribute setting in API

* Use get name instead of get title

* variation id usage

* Improved cross sell templates

* variation_data

* Grouped product sync

* Notices

* Sync is not needed in API

* Delete

* Rename interfaces

* Update counts in data store
2016-11-16 12:17:00 +00:00
Mike Jolley d8fcfcefb8 Variations API endpoint fixes 2016-11-15 12:51:26 +00:00
Mike Jolley c18f6efeb4 Conflicts from master 2016-11-15 11:52:05 +00:00
Claudio Sanches b1c32e5e50 Products endpoint tweaks (#12354)
* Var type already normalized on CRUD

* Let Product CRUD handle with validation, sanitization and conditional checks

* Set downloads using WC_Product_Download

* Stop try catch exceptions more than one time

* Handle WC_Data_Exception in legacy API

* Complete remove products when fails on creating

* On creating I mean!

* Already have a method to complete delete products

* Fixed standards using WP CodeSniffer

* get_the_terms() returns false when empty

* get_manage_stock returns boolean

@claudiosanches
2016-11-15 10:26:42 +00:00
Mike Jolley 00ed627b29 Data stores 2016-11-14 18:18:08 +00:00
Claudio Sanches 657bd226f8 Removed API todos 2016-11-14 14:43:30 -02:00
Claudio Sanches 4827225454 Add variations CRUD to legacy API (#12331)
* Apply crud to variable products in legacy API v1

* New REST API do not need fallback for default attributes

* Apply variations CRUD to legacy API v2

* Legacy v2 - save default attributes

* Variations in legacy API v2 do not have descriptions

* Fixed legacy API v2 variations params

* Applied variations CRUD to legacy API v3

* Sync before save in legacy apis

* Punc
2016-11-14 11:31:52 +00:00
Claudio Sanches 6de7984f2d Fixed a few fatal errors and warnings in Products CRUD (#12329)
* Fixed a few fatal errors and warnings in Products CRUD

* Fixed sync functions
2016-11-14 11:02:56 +00:00
Claudio Sanches 83f74145ee Updated how create initial product variation 2016-11-11 17:29:56 -02:00
Claudio Sanches 1f31de39d9 Fixed variable description in REST API 2016-11-11 16:36:58 -02:00
Mike Jolley bc9d2c72aa TODO is not accurate. 2016-11-11 18:09:06 +00:00
Claudio Sanches 3dfb4c98e3 Fixed coding standards 2016-11-11 15:19:40 -02:00
Claudio Sanches cc109a7e0a Removed duplicated sync 2016-11-11 14:58:03 -02:00
Claudio Sanches 518c3a3467 Allow set tax class as "parent" 2016-11-11 14:58:03 -02:00
Claudio Sanches a17af7ad30 New default attributes method 2016-11-11 14:56:03 -02:00
Claudio Sanches 47e3f22810 Remove deprecated get_variation_id() 2016-11-11 14:56:03 -02:00
Claudio Sanches 5cab607be7 Use variations CRUD to save variations metadata 2016-11-11 14:56:03 -02:00
Claudio Sanches 9fd64f49e4 Updated get methods on REST API for variations 2016-11-11 14:56:02 -02:00
Mike Jolley ac6bda2f62 Product crud abstract todos (#12316)
* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback

* Fix up store
2016-11-11 15:31:00 +00:00
Justin Shreve 90e43d97de [Product CRUD] Product Datastore (#12317)
* Fix up tests in the product/* folder.

* Handle data store updates for grouped, variable, external, simple, and general data store updates for products.

* Variations & variable changes.

* Update -functions.php calls to use data store.

* Add an interface for the public product data store methods.

* Finished product factory tests

* Correctly delete in the api, fix up some comments, and implement an interface for the public variable methods.

* Fix up delete in all versions of the api

* Handle feedback

* Match protected decloration to parent
2016-11-11 14:31:15 +00:00
Mike Jolley 4fc03c9930 Revert "[Product CRUD] Abstract todos (#12305)"
This reverts commit 9a6136fcf8.
2016-11-11 11:58:57 +00:00
Mike Jolley 9a6136fcf8 [Product CRUD] Abstract todos (#12305)
* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback
2016-11-11 11:43:52 +00:00
Claudio Sanches fe4b45481d Include security data in system status endpoint 2016-11-09 22:19:12 -02:00
Mike Jolley 09ea4ba91f [Product CRUD] Variable, variation, notices, and stock handling (#12277)
* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback
2016-11-09 16:10:37 +00:00
Justin Shreve 9072b1da43 Handle PR feedback 2016-11-09 16:05:50 +00:00
Justin Shreve e551a846b8 Implement CRUD in the legacy REST API 2016-11-09 16:05:50 +00:00
Mike Jolley 5f4dbdb733 [Product CRUD] Variations - setters, getters and admin. (#12228)
* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes
2016-11-09 16:05:49 +00:00
Justin Shreve 1985620f33 Fix comparison for is_on_sale and remove download_type from WC_Product. 2016-11-09 15:47:23 +00:00
Justin Shreve 37c8e62fcf Fix final failing tests and implementing setters/getters and attributes functionality. 2016-11-09 15:47:23 +00:00
Justin Shreve e31a75d584 Additional API updates/fixes. Added some todos 2016-11-09 15:47:23 +00:00
Justin Shreve bcae6fb1d6 REST API CRUD Updates 2016-11-09 15:47:23 +00:00
Mike Jolley af32b3ea91 Product crud admin save routine (#12174)
* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Spacing

* Fix comment

* wc_implode_text_attributes helper function
2016-11-09 15:43:20 +00:00
Claudio Sanches f23a529329 [REST API] Throw messages when trying to manipulate variations in products endpoint 2016-11-08 13:55:33 -02:00
Claudio Sanches e1b914d227 Reverted changes that allowed manipulate variations on products endpoint (#12255) 2016-11-08 11:14:01 +00:00
Claudio Sanches 0c3b0f57e9 [REST API] Delete refund if payment gateway API fails, closes #12248 2016-11-04 18:06:15 -02:00
Claudio Sanches fa7775254b REST API - Allow remove product category image (#12247)
* Allow remove product category images

* Allow remove sending an empty array too
2016-11-04 10:19:34 +00:00
Rami Yushuvaev 55f08d62ae add translators comments 2016-10-29 23:03:28 +03:00
Rami Yushuvaev 93d55dade9 add translators comments 2016-10-29 20:32:38 +03:00
Claudio Sanches c58940258a Updated $order->id to $order->get_id() 2016-10-25 22:46:36 -02:00
Rami Yushuvaev 140d0efb99 i18n: Avoid using HTML tags in translation strings (#12166)
* i18n: Remove some HTML tags from translation strings

* i18n: simpler translation string

* i18n: translations strings with surrounding `<strong>` HTML tags should be moved outside the translation string

* i18n: Avoide using `<code>' HTML tags in translation strings

* i18n: Split the notice to avoide using HTML tags in translation strings
2016-10-24 21:56:37 -02:00
Daniel Hüsken ab7f9dd674 Flush rewrite rules with cron for attribute terms (#12132) 2016-10-21 15:29:50 +01:00
Mike Jolley 73408342bc Correct $value in API 2016-10-19 17:16:13 +01:00
Mike Jolley 81778555c8 Use order statuses when getting refunds in api.
Closes #12102

@claudiosmweb
2016-10-19 12:53:49 +01:00
Claudio Sanches f218b6cfd9 [REST API] Allow filter by on sale products, closes #12093 (#12105) 2016-10-18 11:40:13 +01:00
Claudio Sanches ee061f98ec [REST API] Better sanitization for product taxonomy filters 2016-10-17 14:39:02 -02:00
Bryce Adams ea1f9aea65 Remove last order from customers part of the API (#12081)
Proposed solution to close #12080

* Also removes from tests.
2016-10-14 14:38:35 +01:00
Claudio Sanches 507bbffc66 Fixed coding standards 2016-10-14 11:19:20 +01:00
Claudio Sanches ec79238f30 Added min_price and max_price product filter 2016-10-14 11:19:20 +01:00
Claudio Sanches 2400a72b93 Filter products in stock or out of stock 2016-10-14 11:15:11 +01:00
Claudio Sanches e57ae3da27 Filter products by tax class 2016-10-14 11:15:11 +01:00
Claudio Sanches 842c39b525 Make easy to add query_meta 2016-10-14 11:15:11 +01:00
Claudio Sanches 92404fc867 Allow filter products by featured post meta 2016-10-14 11:15:11 +01:00
Claudio Sanches 4aa1689015 Better description for product taxonomy filters 2016-10-14 11:15:11 +01:00
Manos Psychogyiopoulos 4658245625 Revise the stock + stock status saving logic (#11858)
* use set_stock to reset stock meta when not managing stock

Ensures that the 'woocommerce_{ variation | product }_set_stock' hooks fire to refllect the fact that stock becomes infinite.

* track state of Manage Stock? option

* quick/bulk edit fixes

* reapply quick and bulk edit fixes

* improve conditional reset logic that prevents actions from *_set_stock actions from firing with every save
2016-10-12 12:51:40 +01:00
Claudio Sanches 657c312cae Fix strings case (#12069)
* Fixed case for all _e, esc_attr_e and esc_html_e strings

* Fixed case for all _n_noop strings

* Fixed case for all _x strings

* Fixed case for all __, esc_html__ and esc_attr__ strings

* Fixed a few more strings

* Fixed strings in unit tests

* Fix PayPal Standard case.

* Save Order text
2016-10-12 11:16:30 +01:00
Claudio Sanches 77722ecbe3 Fixed missing text domains (#12066) 2016-10-12 11:05:37 +01:00
Rami Yushuvaev 65cf1bcb6f Merge branch 'master' of https://github.com/ramiy/woocommerce into i18n/similar-strings 2016-10-11 21:14:56 +03:00
Daniel Hüsken 9b12df381e Rest-API fix action not called if no core attribute param updated 2016-10-11 13:40:54 +02:00
Rami Yushuvaev 83e938af1e i18n: Merge similar translation strings to reduce the total strings count #11905 2016-10-11 04:39:13 +03:00
Claudio Sanches 0d756deb1c [REST API] Allow filter order note by type 2016-10-05 12:27:06 -03:00
Claudio Sanches 226482baf5 Fixed coding standards 2016-10-04 14:36:18 -03:00
Claudio Sanches c62c5b835e Updated values to check if line item is null 2016-10-04 13:39:37 -03:00
rspublishing 180ac717a8 Coding standards 2016-09-30 16:23:17 +02:00
rspublishing 424948f4de Coding standards 2016-09-30 16:15:56 +02:00
rspublishing 5814dc3a97 Adds a system status tool for clearing orphaned variations 2016-09-30 10:39:37 +02:00
Justin Shreve ca10cca69b Merge pull request #11990 from woocommerce/variations-rest-api
Implement Variation Endpoints & Tests
2016-09-29 15:48:36 -07:00
Justin Shreve c1d7111240 Implement separate variation endpoints for managing a product's variations. Also adds tests. 2016-09-29 14:44:14 -07:00
Claudio Sanches 1230be795e Fixed REST API docs, codeclimate and coveralls URLs 2016-09-28 09:09:06 -03:00
Matty d037c4a3f2 Ensures any checks for 'woothemes.com' in logic also check for 'woocommerce.com'. 2016-09-28 12:19:58 +02:00
Claudio Sanches 9817caccdd Removed multiple lines #11915 2016-09-14 11:27:11 -03:00
Taylor Lovett 01a92a3bcb Add filter to continue uploading images if one fails (api) 2016-09-13 21:03:05 -04:00