I am trying to update the product via the WooCommerce REST API. But I am getting an error.
This is the HTML form:
<form action="update_product_connect.php" name="update" method="post">
<tbody>
<?php foreach ( $data as $row ) : ?>
<tr>
<td><?= $row['id']; ?></td>
<td><input type="text" name="namee" value="<?= $row['name']; ?>"/></td>
<td><input type="text" name="descriptions" value="<?= $row['description']; ?>"/></td>
<td><input type="text" name="short_descriptions" value="<?= $row['short_description']; ?>"/></td>
<td><input type="number" name="regular_pricee" value="<?= $row['regular_price']; ?>"/></td>
<td><input type="submit" name="sil" value="kaydet" /></form>
</td>
</tr>
<?php endforeach; ?>
And this is the code inside the update_product_connect.php file that sends the HTTP call to update the product.
<?php
$dataname = $_POST['namee'];
$dataprice = $_POST['regular_pricee'];
$datadescription = $_POST['descriptions'];
$datashort_description = $_POST['short_descriptions'];
$data =
[
'name' => $_POST['namee'],
'regular_price' => $_POST['regular_pricee'],
'description' => $_POST['descriptions'],
'short_description' => $_POST['short_descriptions'],
];
?>
<?php echo json_encode($woocommerce->PUT('products', $data)); ?>
Below is a screenshot of the error I'm getting:
