Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
curl -X POST https://example.com/wp-json/wc/v2/products \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"name": "Build Your Ninja Outfit",
"type": "composite",
"description": "In pretium enim justo, at ornare libero aliquam quis. Nullam imperdiet rutrum volutpat. Suspendisse aliquet ex in ex volutpat vestibulum. Curabitur ultrices convallis condimentum.",
"short_description": "In pretium enim justo, at ornare libero aliquam quis.",
"categories": [
{
"id": 9
}
],
"images": [
{
"src": "https://www.somewherewarm.net/cp/woo/wp-content/uploads/Ninja_bundle.jpg",
"position": 0
}
],
"composite_components": [
{
"title": "Your Ninja Tee",
"description": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.",
"query_type": "category_ids",
"query_ids": [ 14 ],
"quantity_min": 1,
"quantity_max": 1,
"priced_individually": true,
"shipped_individually": false,
"optional": false,
"discount": "20.0",
"options_style": "thumbnails"
},
{
"title": "Your Ninja Hoodie",
"description": "Nullam imperdiet rutrum volutpat. Suspendisse aliquet ex in ex volutpat vestibulum. Curabitur ultrices convallis condimentum.",
"query_type": "category_ids",
"query_ids": [ 10 ],
"quantity_min": 1,
"quantity_max": 1,
"priced_individually": true,
"shipped_individually": false,
"optional": false,
"discount": "20.0",
"options_style": "thumbnails"
}
],
"composite_layout": "single"
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment