jasonknight / woocommerce-json-api Goto Github PK
View Code? Open in Web Editor NEWA simple, Abstract JSON API for Wordpress' Awesome Plugin: WooCommerce
A simple, Abstract JSON API for Wordpress' Awesome Plugin: WooCommerce
Pls can write access to Woocommerce settings be added to the API.
Hi,
Today I found an issue with the images/featured images. I have a release from the 24th of september where the featured image was a string. Now the featured image is an array with metadata and the new image-array is added. On some products, the new featured-image array is empty, while a featured image is actually set. If I change the API to the old (24th) the featured image is set again.
I don't know what could be the cause of the bug but I could give you the URL/api key of the webshop so you can test it yourself. It only occurs on 2 of the 45 products and I made sure the images are set..
Let me know if you want access to test it.
Hi guys, I'm a new comer. I try install this plugin but dun know how to use it, i have read though the doc and wiki but no luck. I saw the way you call it in jQuery but i still misunderstand. I want to know which url will be used to call, for example, call to get products maybe uses the url like this www.example.com/api/get_products, please give the short description or references.
Thank a lot.
Can support for deleting product be added.
Can write support be added to orders.
All I just need is changing the order status.
get_coupons -> payload -> exclude_product_ids
It is a weird string but get_supported_attributes defines it as an Array. Here the raw response:
{
"action": "woocommerce_json_api",
"proc": "get_coupons",
"arguments": {
"token": "1234"
},
"status": true,
"errors": [],
"warnings": [],
"notifications": [],
"payload": [
{
"id": "21",
"code": "cc1",
"slug": "cc1",
"type": "shop_coupon",
"publishing": "publish",
"discount_type": "fixed_cart",
"value": "10",
"is_exclusive": "yes",
"limit": "100",
"product_ids": "s:100:\"s:92:\"s:84:\"s:76:\"s:68:\"s:60:\"s:52:\"s:44:\"s:36:\"s:28:\"s:20:\"s:12:\"s:5:\"16,15\";\";\";\";\";\";\";\";\";\";\";\";\";",
"exclude_product_ids": "19",
"expiry_date": "2013-09-25",
"is_before_tax": "yes",
"is_shipping_free": "",
"will_exclude_sale_products": "yes",
"product_category_ids": [
13,
14
],
"exclude_product_category_ids": [
13,
14
],
"minimum_total": "3",
"customer_email": [
"[email protected]",
"[email protected]"
]
}
],
"payload_length": 1
}
This is a security risk and also prevents users from making further JSON requests. When a JSON AJAX request is made, the server returns the regular Wordpress HTML
Can read access be added to reports.
Hello and thank you some much for developing this plugin!
I'm really interested in using it since I'm developing a webapp that really needs this plugin. I've tried your example to start working and I don't know why it's not. working.
I've activated the plugin and used your example but it's not working. Sorry to bother you but here is my question on Stackoverflow and my code: http://stackoverflow.com/questions/18500372/getjson-method-returns-an-error-using-woocommerce-json-api-plugin
I would really appreciated if you could help me! Or if not is there any way I can contact you via e-mail or something? Thank you so much!
It would be useful to replace "timestamp" and "datetime" with a parse-able format similar to "date(y-m-d)" Currently, all 3 are listed by the method get_supported_attributes
Can support for deleting product variation be added.
[attributes] => Array
(
[size] => Array
(
[name] => Size
[value] => Array
(
[0] => Small
[1] => Medium
[2] => Large
)
[position] => 1
[is_visible] => no
[is_variation] => yes
[is_taxonomy] => no
)
)
A variation is usually attached to a attributes.
How can I link a variation to its attribute.
Would really appreciate if you can add a field to link a variation to a attribute.
In the code above I have an attribute called Size, in the code below this are variation that are attached to the Size attribute, but there is no way to link the variation to its attributes.
[variations] => Array
(
[0] => Array
(
[id] => 123
[name] => Variation #123 of Shoeee
[slug] => product-26-variation
[type] => product_variation
[description] =>
[short_description] =>
[parent_id] => 26
[publishing] => publish
[sku] => SZ345
[downloadable] => no
[visibility] => visible
[virtual] => no
[manage_stock] => no
[sold_individually] => no
[featured] => no
[allow_backorders] => no
[quantity] => 45
[height] =>
[weight] => 5
[length] =>
[price] => 4800
[regular_price] => 5000
[sale_price] => 4800
[sale_from] =>
[sale_to] =>
[status] => instock
[attributes] => Array
(
)
[tax_class] =>
[tax_status] => none
[product_type] => product
[categories] => Array
(
)
[tags] => Array
(
)
[reviews] => Array
(
)
[variations] => Array
(
)
[images] => Array
(
)
[featured_image] => Array
(
)
)
)
In the app we are building that is leveraging the Woocommerce JSON API, when creating a variation for a product we want to send the following things title of the variation, name of the variation, sku of the variation, price of the product variation and the stock quantity. Because following the example in set_product_variation the attribute isn't passed, but in our case we want to pass an attribute like Size and pass some values along like Small, Medium and Large. The variation that we create we want to link each of them to an attribute value. Like linking a variation to a attribute called Size with a value of Small.
Is there need for us to send an attribute for example size along with the payload data.
You know better, would appreciate if you can explain this clearly.
Instead it should return an error that the sku field is required
Results should be similar to catagories. Show all tags for each product (not sure about all the fields, what I really need is the name and the slug of a tag).
...
"tax_status": "",
"categories": [
{
"id": "6",
"name": "Listening",
"slug": "listening",
"description": "Description",
"parent_id": "0",
"count": "4",
"group_id": "0",
"taxonomy_id": "23"
}
],
"tags": [
{
"id": "6",
"name": "Level 1",
"slug": "level-1",
"description": "Description",
"parent_id": "0",
"count": "4",
"group_id": "0",
"taxonomy_id": "23"
}
]
...
We need read/write in core WP capabilities like
Read/write/delete pages
Read/write/delete posts
Read/write/delete menus
Read/write reading setting (under Settings for WP)
Read/write/delete users
Read/write/delete comments
The images returned when using get_products have the wrong url and base_url.
In the array shown below the url is that of a multisite install, it shouldn't have the multisite name in this case 'merchant', the url is meant to be returned as http://localhost/cartmultisite/wp-content/uploads/sites/2/2013/10/Mens-Athletic-Fit-150x150.jpg instead of http://localhost/cartmultisite/merchant/wp-content/uploads/sites/2/2013/10/Mens-Athletic-Fit-150x150.jpg.
One other thing is that the month arguments is meant to be 6, but it keeps fetching 10. I tried this in a normal WP install and a multisite install and the same value of 10 is being returned.
The url is meant to be http://localhost/cartmultisite/wp-content/uploads/sites/2/2013/06/Mens-Athletic-Fit-150x150.jpg and not http://localhost/cartmultisite/wp-content/uploads/sites/2/2013/10/Mens-Athletic-Fit-150x150.jpg
(
[file] => Mens-Athletic-Fit-150x150.jpg
[width] => 150
[height] => 150
[mime-type] => image/jpeg
[url] => http://localhost/cartmultisite/merchant/wp-content/uploads/sites/2/2013/10/Mens-Athletic-Fit-150x150.jpg
)
[featured_image] => Array
(
[0] => Array
(
[id] => 90
[filename] => T_1_front
[slug] => t_1_front
[mime_type] => image/jpeg
[type] => attachment
[description] =>
[caption] =>
[parent_id] => 0
[publishing] => inherit
[path] => 2013/06/T_1_front.jpg
[metadata] => Array
[url] => http://localhost/cartdemo/2013/06/T_1_front.jpg
[base_url] => http://localhost/cartdemo/wp-content/uploads/2013/10
First of all, thanks for creating this JSON API. It looks awesome.
I have a woocommerce shop with product attributes. Attributes of type "Text". I have tested the get products API Call get_products. Products are returned but attributes values are empty.
I attach you a screenshot that illustrates the issue. Thanks in advanced.
I already install the plugin and activated it but when I try my HTML I don't see anything. It says 'Unexpected token' something.
here is my code:
http://pastebin.com/Sd8qbsju
do I need to edit config.php in the folder?
it still localhost something, should I use my domain name on this?
When using the set_product method product_type is always set to product, no matter if I specify simple or variable as the value.
The product is created successfuly but the wrong product_type is set.
Output of the get_product_by_id of a product created with set_product
[id] => 176
[name] => An API Created Product 6187439
[slug] => an-api-created-product-6187439
[type] => product
[description] =>
[short_description] =>
[parent_id] => 0
[publishing] => publish
[sku] => API6187439
[downloadable] => no
[visibility] => visible
[virtual] => no
[manage_stock] => no
[sold_individually] => no
[featured] => no
[allow_backorders] => no
[quantity] =>
[height] =>
[weight] =>
[length] =>
[price] => 6.25
[regular_price] => 6.25
[sale_price] =>
[sale_from] =>
[sale_to] =>
[status] => instock
[attributes] => Array
(
)
[tax_class] =>
[tax_status] => none
[product_type] => product
[categories] => Array
Would be grateful if this can be looked into.
"Category": {
"id": {
"name": "term_id",
"type": "number",
"sizehint": 1
},
Not sure if this is intentional, but I don't think so because Category is the only class that has a supported id attribute.
I'm getting this, though other models work:
Raw JSON Request
{
"action": "woocommerce_json_api",
"proc": "get_images",
"arguments": {
"token": "1234",
"order_by": "name",
"order": "ASC"
}
}
Raw JSON Response
{
"action": "woocommerce_json_api",
"proc": "get_images",
"arguments": {
"token": "",
"order_by": "name",
"order": "ASC"
},
"status": false,
"errors": [
{
"text": "Permissions for this user have not been set",
"code": -7
},
{
"text": "Not a valid API User",
"code": -4
}
],
"warnings": [],
"notifications": [],
"payload": [],
"payload_length": 0
}
I was using the API on my local environment and it was working fine.
But when I switch to a live environment for testing all I am getting back is 1.
What might be the cause of this.
All users coming to site are for some reason automatically signed in as the API user set for this plugin. I restricted all the rights so they cannot change anything.
However, the data in order form are saved to this user account and showed next time someone else comes to the order page. Any idea how to prevent this?
Thanks
Using the recent release of the API, get_orders() isn't returning any orders.
Great work. Everything works fine. One more detail - I am trying to build a widget for other websites to show products from my eshop. Due the cross-domain restrictions I have to use JSONP. Can you add a JSONP toggle?
The only difference is in the format of the output:
JSON:
{"red" : "#f00"}
JSONP:
jQuery16406345664265099913_1319854793396({"red" : "#f00"})
where jQuery16406345664265099913_1319854793396 is a value from the querystring "callback".
No matter which fields I set, set_orders does not return a payload.
I send:
{
"action": "woocommerce_json_api",
"proc": "set_orders",
"arguments": {
"token": "1234"
},
"payload": [
{
"name": "name",
"guid": "guid",
"order_key": "key",
"billing_first_name": "firstname",
"billing_last_name": "lastname",
"billing_company": "company",
"billing_address_1": "address1",
"billing_address_2": "address2",
"billing_city": "bcity",
"billing_postcode": "bpc",
"billing_country": "bc",
"billing_state": "bs",
"billing_email": "be",
"billing_phone": "bp",
"shipping_first_name": "sfn",
"shipping_last_name": "sln",
"shipping_company": "sc",
"shipping_address_1": "sa1",
"shipping_address_2": "sa2",
"shipping_city": "sc",
"shipping_postcode": "sp",
"shipping_country": "sc",
"shipping_state": "ss",
"shipping_method": "sm",
"shipping_method_title": "sm",
"payment_method": "pm",
"payment_method_title": "pmt",
"order_discount": "1",
"cart_discount": "1",
"order_tax": "1",
"order_shipping": "1",
"order_shipping_tax": "1",
"order_total": "1",
"customer_user": "1",
"completed_date": {},
"status": "completed"
}
]
}
I always get:
{
"action": "woocommerce_json_api",
"proc": "set_orders",
"arguments": {
"token": "1234"
},
"payload": [],
"status": true,
"errors": [],
"warnings": [],
"notifications": [],
"payload_length": 0
}
Hi,
Could you please explain more why this plugin cannot work while user logged into WP? I really don't understand why. Because I'm in a project that requires adding new product (also adding that one to cart) while user logged or hasn't logged yet. But for now, while user logged, we just get fail. As author of this plugin could you explain more and any chances we can make this plugin work in this case?
Thank you very much! You are doing great job!
Don
The Woocommerce user interface in Wordpress, on the Coupons page, shows a weird customer email address:
a:1:{i:0;s:0:"";}
The request I made:
{
"action": "woocommerce_json_api",
"proc": "set_coupons",
"arguments": {
"token": "1234"
},
"payload": [
{
"code": "cc4",
"slug": "",
"type": "shop_coupon",
"publishing": "publish",
"discount_type": "",
"value": "",
"is_exclusive": "yes",
"limit": "",
"product_ids": [
""
],
"exclude_product_ids": "",
"expiry_date": "",
"is_before_tax": "yes",
"is_shipping_free": "yes",
"will_exclude_sale_products": "yes",
"product_category_ids": [
""
],
"exclude_product_category_ids": [
""
],
"minimum_total": "",
"customer_email": [
""
]
}
]
}
Similarly, when I send an email address with it:
"customer_email": [
"[email protected]"
]
The backend shows:
a:1:{i:0;s:7:"[email protected]";}
Hi,
First of all, thanks for the API, I really like it.
I'm developing a multi-platform app for Woocommerce using your API. I've got an user with the API-key set up by hand. But is it possible to automatically set an API key on registration (e.g. User registers on the website, the API key now is empty, I would like to set it to some value).
Is it also possible to set the default permissions for a newly registered user?
Then the last question... Is there any way to "log the user in" and retrieve the API key?
Thanks in advance!
get_api_methods gives the following order_by values:
get_images": {
"order_by": {
"type": "string",
"values": [
"id",
"count",
"name",
"slug"
],
"default": "name",
"required": false,
"sizehint": 1,
"description": "What column to order results by"
},
However, when sending
{
"action": "woocommerce_json_api",
"proc": "get_images",
"arguments": {
"token": "1234",
"order_by": "name",
"order": "ASC"
}
}
i am getting error -5 order_by must be one of these:ID,post_title,post_date,post_author,post_modified
Hi there,
Could you tell me how to set featured_image when creating new product? If it hasn't been implemented yet, could you give me some ideas to implement it?
Thank you!
Hello, newbie here. I'm trying to figure out what is "c6db13944977ac5f7a8305bbfb06fd6a" in the URL below. What what would my URL be for making requests?
var url = 'http://woo.localhost/c6db13944977ac5f7a8305bbfb06fd6a/?callback=?';
Hi Jason,
I hope you can help me out on this one :-)
I just downloaded a new version of your API. I can't find the reason and can't find a bug in your code... but on one product, and only that one, the image array is returning the wrong (and only 3 out of 6) images. The featured image array is returning the right image.
I removed the real website url, but could PM it to you if you wish to have it.
The urls it should return are 3 the following:
http://website.nl/wp-content/uploads/2013/07/SK055-schuin-vooraanzicht.jpg
http://website.nl/wp-content/uploads/2013/07/SK055-vooraanzicht.jpg
http://website.nl/wp-content/uploads/2013/07/SK055-achteraanzicht.jpg
The product id is 211 and the returned object is the following (xCode..):
2013-10-13 22:26:33.802 Test[8704:a0b] Images array is: (
{
alt = "";
caption = "";
description = "";
filename = "SK082 vooraanzicht met licht";
id = 265;
metadata = {
file = "2013/07/SK082-vooraanzicht-met-licht.jpg";
height = 667;
"image_meta" = {
aperture = 0;
camera = "";
caption = "";
copyright = "";
"created_timestamp" = 0;
credit = "";
"focal_length" = 0;
iso = 0;
"shutter_speed" = 0;
title = "";
};
sizes = {
medium = {
file = "SK082-vooraanzicht-met-licht-300x300.jpg";
height = 300;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK082-vooraanzicht-met-licht-300x300.jpg";
width = 300;
};
"shop_catalog" = {
file = "SK082-vooraanzicht-met-licht-150x150.jpg";
height = 150;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK082-vooraanzicht-met-licht-150x150.jpg";
width = 150;
};
"shop_single" = {
file = "SK082-vooraanzicht-met-licht-300x300.jpg";
height = 300;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK082-vooraanzicht-met-licht-300x300.jpg";
width = 300;
};
"shop_thumbnail" = {
file = "SK082-vooraanzicht-met-licht-90x90.jpg";
height = 90;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK082-vooraanzicht-met-licht-90x90.jpg";
width = 90;
};
thumbnail = {
file = "SK082-vooraanzicht-met-licht-150x150.jpg";
height = 150;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK082-vooraanzicht-met-licht-150x150.jpg";
width = 150;
};
};
url = "http://website.nl/wp-content/uploads/2013/07/SK082-vooraanzicht-met-licht.jpg";
width = 667;
};
"mime_type" = "image/jpeg";
"parent_id" = 211;
path = "2013/07/SK082-vooraanzicht-met-licht.jpg";
publishing = inherit;
slug = "sk082-vooraanzicht-met-licht";
type = attachment;
},
{
alt = "";
caption = "";
description = "";
filename = "SK055 vooraanzicht met licht";
id = 266;
metadata = {
file = "2013/07/SK055-vooraanzicht-met-licht.jpg";
height = 667;
"image_meta" = {
aperture = 0;
camera = "";
caption = "";
copyright = "";
"created_timestamp" = 0;
credit = "";
"focal_length" = 0;
iso = 0;
"shutter_speed" = 0;
title = "";
};
sizes = {
medium = {
file = "SK055-vooraanzicht-met-licht-300x300.jpg";
height = 300;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK055-vooraanzicht-met-licht-300x300.jpg";
width = 300;
};
"shop_catalog" = {
file = "SK055-vooraanzicht-met-licht-150x150.jpg";
height = 150;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK055-vooraanzicht-met-licht-150x150.jpg";
width = 150;
};
"shop_single" = {
file = "SK055-vooraanzicht-met-licht-300x300.jpg";
height = 300;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK055-vooraanzicht-met-licht-300x300.jpg";
width = 300;
};
"shop_thumbnail" = {
file = "SK055-vooraanzicht-met-licht-90x90.jpg";
height = 90;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK055-vooraanzicht-met-licht-90x90.jpg";
width = 90;
};
thumbnail = {
file = "SK055-vooraanzicht-met-licht-150x150.jpg";
height = 150;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK055-vooraanzicht-met-licht-150x150.jpg";
width = 150;
};
};
url = "http://website.nl/wp-content/uploads/2013/07/SK055-vooraanzicht-met-licht.jpg";
width = 667;
};
"mime_type" = "image/jpeg";
"parent_id" = 211;
path = "2013/07/SK055-vooraanzicht-met-licht.jpg";
publishing = inherit;
slug = "sk055-vooraanzicht-met-licht";
type = attachment;
},
{
alt = "";
caption = "";
description = "";
filename = "SK052 vooraanzicht met licht";
id = 267;
metadata = {
file = "2013/07/SK052-vooraanzicht-met-licht.jpg";
height = 667;
"image_meta" = {
aperture = 0;
camera = "";
caption = "";
copyright = "";
"created_timestamp" = 0;
credit = "";
"focal_length" = 0;
iso = 0;
"shutter_speed" = 0;
title = "";
};
sizes = {
medium = {
file = "SK052-vooraanzicht-met-licht-300x300.jpg";
height = 300;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK052-vooraanzicht-met-licht-300x300.jpg";
width = 300;
};
"shop_catalog" = {
file = "SK052-vooraanzicht-met-licht-150x150.jpg";
height = 150;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK052-vooraanzicht-met-licht-150x150.jpg";
width = 150;
};
"shop_single" = {
file = "SK052-vooraanzicht-met-licht-300x300.jpg";
height = 300;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK052-vooraanzicht-met-licht-300x300.jpg";
width = 300;
};
"shop_thumbnail" = {
file = "SK052-vooraanzicht-met-licht-90x90.jpg";
height = 90;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK052-vooraanzicht-met-licht-90x90.jpg";
width = 90;
};
thumbnail = {
file = "SK052-vooraanzicht-met-licht-150x150.jpg";
height = 150;
"mime-type" = "image/jpeg";
url = "http://website.nl/wp-content/uploads/2013/07/SK052-vooraanzicht-met-licht-150x150.jpg";
width = 150;
};
};
url = "http://website.nl/wp-content/uploads/2013/07/SK052-vooraanzicht-met-licht.jpg";
width = 667;
};
"mime_type" = "image/jpeg";
"parent_id" = 211;
path = "2013/07/SK052-vooraanzicht-met-licht.jpg";
publishing = inherit;
slug = "sk052-vooraanzicht-met-licht";
type = attachment;
}
)
When using get_product all variations of the product is being returned as a product.
Would be grateful if this can be looked into.
A sample response of the product variation that is returned is shown below.
[18] => Array
(
[id] => 110
[name] => Variation #110 of TWLC Reach 4 Me
[slug] => product-46-variation
[type] => product_variation
[description] =>
[short_description] =>
[parent_id] => 46
[publishing] => publish
[sku] => RED123
[downloadable] => no
[visibility] => visible
[virtual] => no
[manage_stock] => no
[sold_individually] => no
[featured] => no
[allow_backorders] => no
[quantity] => 15
[height] =>
[weight] =>
[length] =>
[price] => 6250
[regular_price] => 6500
[sale_price] => 6250
[sale_from] =>
[sale_to] =>
[status] => instock
[attributes] => Array
(
)
[tax_class] =>
[tax_status] => none
[product_type] => product
[categories] => Array
(
)
[tags] => Array
(
)
[reviews] => Array
(
)
[variations] => Array
(
)
[images] => Array
(
)
[featured_image] => Array
(
)
)
How to be a valid api user? I follow all your instruction and still I get errors.
Can the image url be added to the images array when getting products.
Initially the image url was part of the array.
[images] => Array
(
[0] => Array
(
[id] => 5
[filename] => dc-shoes-stock-skate-shoes-leather-for-men-in-white-black~p~4625x_01~1500.3
[slug] => dc-shoes-stock-skate-shoes-leather-for-men-in-white-blackp4625x_011500-3
[mime_type] => image/jpeg
[type] => attachment
[description] =>
[caption] =>
[parent_id] => 4
[publishing] => inherit
[path] => 2013/08/dc-shoes-stock-skate-shoes-leather-for-men-in-white-blackp4625x_011500.3.jpg
[metadata] => Array
(
[width] => 1500
[height] => 1500
[file] => 2013/08/dc-shoes-stock-skate-shoes-leather-for-men-in-white-blackp4625x_011500.3.jpg
[sizes] => Array
(
[thumbnail] => Array
(
[file] => dc-shoes-stock-skate-shoes-leather-for-men-in-white-blackp4625x_011500.3-150x150.jpg
[width] => 150
[height] => 150
[mime-type] => image/jpeg
)
[medium] => Array
(
[file] => dc-shoes-stock-skate-shoes-leather-for-men-in-white-blackp4625x_011500.3-300x300.jpg
[width] => 300
[height] => 300
[mime-type] => image/jpeg
)
[large] => Array
(
[file] => dc-shoes-stock-skate-shoes-leather-for-men-in-white-blackp4625x_011500.3-1024x1024.jpg
[width] => 1024
[height] => 1024
[mime-type] => image/jpeg
)
[post-thumbnail] => Array
(
[file] => dc-shoes-stock-skate-shoes-leather-for-men-in-white-blackp4625x_011500.3-604x270.jpg
[width] => 604
[height] => 270
[mime-type] => image/jpeg
)
[shop_thumbnail] => Array
(
[file] => dc-shoes-stock-skate-shoes-leather-for-men-in-white-blackp4625x_011500.3-90x90.jpg
[width] => 90
[height] => 90
[mime-type] => image/jpeg
)
[shop_catalog] => Array
(
[file] => dc-shoes-stock-skate-shoes-leather-for-men-in-white-blackp4625x_011500.3-150x150.jpg
[width] => 150
[height] => 150
[mime-type] => image/jpeg
)
[shop_single] => Array
(
[file] => dc-shoes-stock-skate-shoes-leather-for-men-in-white-blackp4625x_011500.3-300x300.jpg
[width] => 300
[height] => 300
[mime-type] => image/jpeg
)
)
First of all: many thanks for this great plugin. I'm using it for a seperate web-application and works just great.
I'm using the 'Product Vendor' by Matt Gates : http://shop.mgates.me/shop/wc-marketing/wc-product-vendor/ The webshop I made is a single-shop/multi-vendor concept.
What I'would like to have is the product vendor information included in each product definition by get_products(). And maybe in the future: get_product_by_vendor().
If you're not familiar with Product Vendor, I might be able to help.
Thanks in advance.
Best, Gerrit
After changing the URL in the config, I'm able to get products through tests/get_products.php, but completely unable using the Interface or the example in the Wiki. I always get this error:
error: -3: An unexpected error has occured That attribute count
does not exist to be set to ''. for WCAPI\Product
Base.php:583:WCAPI\Base
Base.php:205:WCAPI\Base
Base.php:680:WCAPI\Base
Base.php:650:WCAPI\Base
version1.php:529:WCAPI\Base
class-wc-json-api.php:214:WC_JSON_API_Provider_v1
woocommerce-json-api-core.php:185:WooCommerce_JSON_API
Unknown:GlobalScope:GlobalScope
plugin.php:406:GlobalScope
wp-settings.php:329:GlobalScope
wp-config.php:101:GlobalScope
wp-load.php:29:GlobalScope
wp-blog-header.php:12:GlobalScope
index.php:17:GlobalScope
Thanks!
I am probably doing something wrong. After following the instructions, this is what I get as a result from the call:
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /wp-content/plugins/woocommerce-json-api-master/classes/class-wc-json-api-product.php on line 144
Here is the code I use:
(function() {
var url = "http://www.mydomain.com/apislug/?callback=?";
$.getJSON( url, {
"action": "woocommerce_json_api",
"proc": "get_products",
"arguments": {
"token": "1234",
"per_page": 20,
"page": 1
}
})
.done(function( data ) {
//more code here
});
})();
Am I doing something wrong or is it a bug in the code?
get_coupons -> payload -> product_ids
get_coupons -> payload -> exclude_product_ids
are returned as strings
"payload": [
{
"id": "21",
"code": "cc1",
"slug": "cc1",
"type": "shop_coupon",
"publishing": "publish",
"discount_type": "fixed_cart",
"value": "10",
"is_exclusive": "yes",
"limit": "100",
"product_ids": "15,16",
"exclude_product_ids": "19",
"expiry_date": "2013-09-25",
"is_before_tax": "yes",
"is_shipping_free": "",
"will_exclude_sale_products": "yes",
"product_category_ids": [
13,
14
],
"exclude_product_category_ids": [
13,
14
],
"minimum_total": "3",
"customer_email": [
"[email protected]",
"[email protected]"
]
}
],
When I tried to add new product by calling proc API "set_products", it created a new post (post_type = post) instead of new product (post_type = product).
I think the reason must be in dynamic_get
function (Base
class).
I know you set attributes for Product model that way:
'type' => array('name' => 'post_type',
'type' => 'string',
'values' => array(
'product',
'product_variation'
),
'default' => 'product',
'sizehint' => 5
),
But in dynamic_get
function, I don't see you used that default value.
Please let me know your thought if I misunderstand.
Thank you!
Request:
{
"action": "woocommerce_json_api",
"proc": "set_categories",
"arguments": {
"token": "1234"
},
"payload": [
{
"id": {},
"name": "catnme",
"slug": "catslug",
"group_id": "",
"description": "desc",
"parent_id": "",
"count": "",
"taxonomy": "",
"taxonomy_id": ""
}
]
}
Apache's error log shows:
PHP Fatal error: Call to a member function fromApiArray() on a non-object in /home/michael/Public/projects/woo/woocommerce-json-api/classes/API_VERSIONS/version1.php on line 847, referer: http://localhost/wp-content/plugins/woocommerce-json-api/tests/interface/
I am trying to assign an already created category to a product by passing the category id, but the category isn't being assigned to the product.
Can this be looked into.
This is how my category argument looks like
'categories' => array(
'id => 24,
)
Not sure if intentional, but I'll list them anyway:
The following are objects instead of Arrays:
get_shipping_methods -> payload -> settings
get_payment_gateways -> paylaod -> settings
get_store_settings -> payload
get_site_settings -> payload
get_supported_attributes lists Coupon -> customer_email as a number
"customer_email": {
"name": "customer_email",
"type": "number",
"sizehint": 1
}
but it should be an Array
When using get_products it fetches and displays all products along with their variations.
Can an option be added like 'fetch_variations' => 'false' so that only the products are fetched without their variations.
Example:
...
"id": "383",
"name": "MP3 News for Level 2 - 2012",
"slug": "mp3-news-level-2",
"type": "product",
"featured-image-url": "http://domain.com/image.jpg",
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.