Commit Graph

126 Commits

Author SHA1 Message Date
Peter 516602b4e3 API should accept bool in is_vat_exempt
Add ? 'yes' : 'no' to force values. API should accept bool here: 
update_post_meta( $order->id, '_is_vat_exempt', $data['is_vat_exempt'] ? 'yes' : 'no' );
2016-02-18 20:14:07 +01:00
Peter ba32ce62ba is_vat_exempt data in API Orders
Save and get is_vat_exempt data in API Orders
2016-01-05 21:24:43 +01:00
Peter fc5e1ded54 Revert "Orders API tax exempt status"
This reverts commit 41b6ae07ed.
2016-01-05 21:18:03 +01:00
Peter 41b6ae07ed Orders API tax exempt status
At this moment we cannot find a way how to create an order using the Orders API with tax exempt status. An additional “is_vat_exempt” API field could be used for this reason. If it is set and true then VAT is not calculated.
2015-12-30 15:30:40 +01:00
Peter 00341a30b3 Revert "[API] Additional hooks in API Orders"
This reverts commit fb798aca49.
2015-12-22 23:55:03 +01:00
Peter fb798aca49 [API] Additional hooks in API Orders
Add some additional hooks to handle custom order data

The new hooks:
woocommerce_api_create_order_item
woocommerce_api_set_order_addresses
woocommerce_api_set_line_item

The new woocommerce_api_create_order_item action contains the id-s of the new items ($new_item_id). The following functions have to be returned the item id-s to be able to pass them to the filter:
* set_item(..) function - return $item_id; 
* set_line_item(..) function - return $item_id;
* set_shipping(..) function - return $shipping_id;
* set_fee(..) functuion - return $fee_id;
* set_coupon(..) functuion - return $coupon_id;
2015-12-22 23:49:01 +01:00
Claudio Sanches 91e5381262 [API] Added order_key in orders response, closes #9823 2015-12-11 01:58:24 -02:00
Claudio Sanches 54f714e184 [API] Introduces expand filter for orders
Show full products, taxes and coupons data.

Usage: ?filter[expand]=products,taxes,coupons

Closes #9551

cc @mikejolley
2015-12-03 19:05:37 -02:00
Claudio Sanches 0b789ed216 [2.4] [API] Fixed early order status change
Closes #9672
2015-12-01 20:04:17 -02:00
Mike Jolley 61e746730f wc_transaction_query function
Only uses transactions if enabled, or read uncommitted is supported
#9279
2015-11-04 14:11:40 +00:00
Claudio Sanches 5465cdadb1 [2.4] Fixed WC_API_Orders::set_line_item(), closes #9338 2015-10-11 11:32:56 -03:00
Claudio Sanches 0547c01418 [API] Removed useless _order_number param in POST/PUT orders, closes #9250 2015-10-01 10:14:42 +02:00
Claudio Sanches 06d31d1f86 [2.4] [API] Added refunded_item_id on GET orders/<id>/refunds endpoint, closes #9196 2015-09-22 14:37:11 -03:00
Claudio Sanches f9fb149551 Allow filter orders by customer id, closes #9162 2015-09-21 19:11:54 -03:00
Florian Ludwig 4e0961333f Restored wc<2.4 behavior of order item meta keys
The previous version of woocommerce showed the machine readable names
in item_meta['key’] especially for the custom variation attributes but
after 2.4 it shows only meta ids in the key.

This commit reverts the behavior to the prior 2.4 behavior.
2015-08-31 17:59:41 +02:00
Claudio Sanches 83bdf82767 Fixed docblock for WC_API_Orders::get_variation_id() 2015-07-16 16:14:39 -03:00
Mike Jolley 817e5355fd Pass $item object, not item meta array
Closes #8419
2015-06-23 10:24:13 +01:00
Claudio Sanches eefd9a24f1 Merge pull request #8330 from justinshreve/api-tax-rounding-8328
Stop using the frontend display setting for tax rounding in the API (#8328)
2015-06-09 13:09:46 -03:00
Claudio Sanches c02052a206 [API] Stop undefined index erros for variations in orders endpoint
@justinshreve
2015-06-09 12:39:37 -03:00
Justin Shreve 1d8b6a58d6 Avoid rounding subtotal_tax and total_tax. Don't call wc_round_tax_total for subtotal, and avoid the call to get_line_tax directly which also calls wc_round_tax_total. 2015-06-09 15:06:30 +00:00
Justin Shreve 651b65f28e Add a unit test for get_variation_id so we know we are getting back the IDs that we want 2015-06-09 13:02:02 +00:00
Justin Shreve 937f93faa6 Clean up some naming and add a clarifying comment for the attribute & pa_ stripping. 2015-06-09 12:41:06 +00:00
Justin Shreve 251636c02e First pass at figuring out what the variation ID is based on variation information being passed in via the API. 2015-06-09 12:41:06 +00:00
Claudio Sanches ebdcb0d9e8 [2.3] [API] Fixed subtotal_tax round and decimal dp, closes #8140 2015-05-27 16:18:02 -03:00
Paul Kilmurray 27d50aef55 default properties for $order_fee class
The add_fee method on WC_Abstract_Order expects taxable, tax, tax_data
and tax_class properties to be present. The API ignores these
properties if taxable = false.
2015-05-14 16:10:56 +08:00
Mike Jolley 2a4f9f77db Throw API exception when order is invalid
Closes #8151 @claudiosmweb
2015-05-13 14:08:12 +01:00
Claudio Sanches 3a29a0b743 Fixed docblocks for WC_API_Orders:bulk() 2015-05-07 12:27:39 -03:00
Claudio Sanches 611cf9b521 [API] Created bulk update/insert for orders #7915 2015-05-06 18:41:48 -03:00
Claudio Sanches d5524a62bf [API] Removed test in WC_API_Orders::set_line_item() 2015-04-24 15:53:39 -03:00
Mike Jolley 30d2ab8af8 Avoid setting is_customer_note when 0
Closes #7995
2015-04-23 11:50:09 +01:00
Claudio Sanches 7ab0d01aa2 [API] Fixed create order method 2015-04-16 15:26:54 -03:00
Mike Jolley d133d35e27 Fix conflict 2015-04-14 11:27:30 +01:00
Claudio Sanches c06b6f13e3 [API] Improved the error messages when sent a empty object, closes #7914 2015-04-13 13:06:19 -03:00
Paul Kilmurray c8d52c7c2d Use wc_stock_amount format function
This allows the REST API to honour the `woocommerce_stock_amount` filter, eg: for decimal quantity values
2015-03-31 18:36:27 +08:00
Guillermo Gette 49f84a7bc6 get product_id using wc_get_product_id_by_sku 2015-03-18 23:11:28 +11:00
Guillermo Gette b8578c044d Merge branch 'master' of github.com:woothemes/woocommerce into create_order_with_product_sku 2015-03-18 23:06:02 +11:00
Mike Jolley 74d46dcc1e Merge pull request #7455 from bryceadams/patch-7433
Proposed solution for api all order status counts
2015-03-18 10:57:34 +00:00
matttallan 4d0e0b71f3 Rollback WCAPI create_order if exception is thrown after wc_create_order
When you use the api to create an order and specify an method_id for
the payment details, but no method_title. You recieve a WP_Error as the
response but a pending order of $0 is still created.
2015-03-13 16:02:42 +10:00
Guillermo Gette e9d20c9f66 update set_line_item to let you set items by sku 2015-03-12 22:52:37 +11:00
Barry Kooij b5d64ba932 Decimal Precision can now be set in all orders API calls.
Fixes #7652
2015-03-09 19:07:02 +01:00
Bryce a0b50541cc Proposed solution for api all order status counts
I’m not sure if this is the best way or if it needs work. What do you
think @maxrice @claudiosmweb?

With `status` set to `any`, it returns:

```
stdClass Object
(
    [count] => stdClass Object
        (
            [pending] => 0
            [processing] => 2042
            [on-hold] => 4
            [completed] => 2993
            [cancelled] => 13
            [refunded] => 0
            [failed] => 4
        )

)
```

If not `any, same as before.

Closes #7433
2015-02-17 13:27:38 +07:00
Claudio Sanches 00916b9e29 Merge pull request #7303 from mattallan/matt/wc-api-orders-tweaks
WC_API_Orders: pass data var to new wrappable api function.
2015-02-05 06:46:34 -02:00
matttallan 6531eb0373 pass data var to wrappable api function. 2015-02-05 15:43:05 +10:00
Mike Jolley 6af80f8e60 Merge pull request #7280 from mattallan/matt/wc-api-orders-tweaks
Some more tweaks to WC API Orders
2015-02-04 11:46:33 +00:00
matttallan e5c3385d3b Change private wc-api method to protected.
Mainly so that it can be used in the new Subscriptions API :)
2015-02-04 11:38:38 +10:00
matttallan f3fbbdeecc Use validate_request() to avoid duplicate code. 2015-02-04 11:38:36 +10:00
matttallan cd085f2adc add an overrideable function to a create custom post.
Especially handy for WC Subscriptions seeing as they extend the Abstract
Order Class.
2015-02-04 11:16:11 +10:00
matttallan c2520a528b changes to avoid writing duplicated code 2015-02-04 09:59:02 +10:00
Claudio Sanches 5f63425e0a [API] Fixed the deleted type for refunds 2015-01-26 19:39:33 -02:00
Claudio Sanches cd88ac0d72 [API] Fixed the refunds returned data 2015-01-26 19:24:54 -02:00