Comments (8)
@callumstrubi we should write a blog post about REST API v3 in the next weeks. About your hook should still work, but probably you should stop using it in v3.
from wc-api-dev.
This is achievable trivially with the hook:
add_filter("woocommerce_rest_pre_insert_product_object", function($product, $request, $creating){
if($request['date'] || $request['date_gmt']){
$date = new \DateTime(($request['date_gmt'] ? $request['date_gmt'] : $request['date']), new \DateTimeZone('UTC'));
$product->set_date_created($date->format('U'));
}
return $product;
}, 10, 3);
from wc-api-dev.
Solved in woocommerce/woocommerce#21117
from wc-api-dev.
Ah excellent, didn't see this in the release notes for 3.5 - do we expect this to be compatible with my hook, or do i need to do testing?
from wc-api-dev.
API v3 will come with a new endpoint though right? So we can plan migration effectively - thank you for the update and hard work in a v3 (WP limitations are constraining v2 too much).
from wc-api-dev.
Comes inside wc/v3
instead of wc/v2
, so yes, you can do a migration to all new endpoints, test before and so on.
from wc-api-dev.
Sorry for comment spam - will wc-api-php be upgraded to support the v3 endpoint in line with it's release or will that come in the following months?
from wc-api-dev.
@callumstrubi already supports, just set the library to connect to v3.
Example:
require __DIR__ . '/vendor/autoload.php';
use Automattic\WooCommerce\Client;
$woocommerce = new Client(
'http://example.com',
'ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
[
'wp_api' => true,
'version' => 'wc/v3',
]
);
from wc-api-dev.
Related Issues (20)
- Fetching customers with specific username gets all the customers HOT 1
- Media Endpoint [ Idea / Suggestion ] HOT 2
- Cannot retrieve products from child category HOT 4
- Filtering products using attributes does not work HOT 1
- Support for multiple order statuses when filtering a get request HOT 2
- Add a field indicating a note "type" to the order notes api HOT 2
- After/before date filtering does not fully support ISO 8601 HOT 2
- Support for hourly stats granularity HOT 3
- shipping_lines response - include `instance id` field HOT 2
- Ability to fetch a list of orders matching more than one status, bonus using a status search wildcard HOT 1
- New endpoint to get woo order statuses HOT 6
- Add total order count in the metadata of the /orders endpoint HOT 1
- When this api version is going to be released HOT 1
- Is there a target date for v4? HOT 1
- Retrieve orders by date modified in 3.6 HOT 3
- Add currencyCode and presentation details to data/continents response HOT 1
- Unit Test Failures (2): Product Variations get_parent_id() HOT 1
- How to contribute in WC API? HOT 1
- More product list orderby settings.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wc-api-dev.