I'm trying to add products using the WooCommerce .Net Rest API. Everything is working fine except for my images. I'm not sure how to add them with PHP.
I get my products from another source that gives me all the images separated by a comma. When I retrieve them I make an array out of it like this:
$afbeeldingen = explode(",", $_POST['afbeeldingen']) ;
For the following part I'm lost.. I have to put the images urls inside the 'images' array like the way it is shown below. I was thinking about using some foreach loop but I'm not sure how to make this work.
$prod_data = [
'name' => $_POST['merk'] . ' ' . $_POST['model'] . ' ' . $_POST['type'],
'type' => 'simple',
'sku' => $_POST['voertuignr_hexon'],
'regular_price' => $_POST['verkoopprijs_particulier'],
'description' => $_POST['opmerkingen'],
'images' => [
[
'src' => image1
],
[
'src' => image2
]
]
];
I would appreciate any help that I can get with this!