Putting aside whether you’re making the API request from and to the same site or not, I assume that the $woocommerce
is an instance of Automattic\WooCommerce\Client
.
And you can use the batch
endpoint for product tags (/wp-json/wc/v3/products/tags/batch
) to create/update/delete multiple (by default, up to 100) product tags at a time. Here’s an example for creating multiple product tags:
$data = [
'create' => [
[
'name' => 'Round toe',
],
[
'name' => 'Flat',
],
],
];
print_r( $woocommerce->post( 'products/tags/batch', $data ) );