Woocommerce attributes

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
vagblad
Posts: 174
Joined: Tue Jun 18, 2013 12:18 pm
DBs Used: MySQL,DBF
Location: Thessaloniki, Greece

Woocommerce attributes

Post by vagblad »

Hello to everyone,

I know it's a long shot unless someone is specifically working with WooCommerce but i thought i would drop my question here anyway:

Long story short, we are building an app to communicate with the Wordpress-Woocommerce plugin and be able to do the basic functions of inserting new products, updating products, deleting products etc. Because we didnt want to write directly to the woocommerce's database we have been using the WooCommerce API to do so.

Went through a lot of iterations and tries and we've decided to do so with sending a REST API request with a JSON file to do all of the above when needed. Now to the problem at hand: When trying to insert a new product everything goes fine up to the point where we need to send the attributes for that specific product. We get no error back from WooCommerce, the product is being created just fine but it has no attributes. It looks like the API completely ignores them. I thought i would ask here in case someone had a similar experience or knowledge around the WooCommerce API. I am also attaching here a sample JSON file. We use the Curl library to communicate with the REST API.

Code: Select all

{ 
"name" : "Test product - 400029",
"description" : "Full description of test product",
"short_description" : "short description of full product",
"regular_price" : "100.00",
"sale_price" : "90.00",
"sku" : "400029",
"categories" : [{ "id": "29"}],
"dimensions" : { "length": "0.00", "width": "0.00", "height": "2"},
"weight" : "1.2", 
"images" : [{ "src": "https://yoursite.com/wp-content/uploads/products/400029.jpg"}],
"attributes" : [{"material": "Gold"},{"color": "Yellow"}]
 }
Thank you in advance
Vagelis Prodromidis
Email: vagblad@gmail.com, Skype: vagblad
Post Reply