I’m really confused here but I want to try create multiple terms via the woocommerce rest api, the example shows one term being added:
$data = [
'name' => 'Leather Shoes'
];
$woocommerce->post('products/tags', $data);
https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-product-tag
When adding a term this way, the rest api requires me to set the array key as name. I thought maybe I just add multiple items like this:
$data = [
'name' => 'Leather Shoes',
'name' => 'tagtest',
'name' => 'helloworld',
];
But because each item is using name as the key, it ends up only setting the last item:
$data = [
'name' => 'Leather Shoes',
'name' => 'Example',
'name' => 'TagTest',
];
var_dump($data);
array (size=1)
'name' => string 'TagTest' (length=7)
Then, tried setting different values other than name and got an error:
Error: Missing parameter(s): name
Question
So I’m trying to figure out how I pass multiple terms/tags to the $woocommerce->post('products/tags')
rest api endpoint.