-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
The following code creates a new product, but doesn't create the meta. Would this be expected to work? If so, can you see anything in the code that doesn't look right? Thanks.
WC REST API v2
WC v 3.0.9
<?php
// Setup:
require('../../../../vendor/autoload.php');
use Automattic\WooCommerce\Client;
$woocommerce = new Client(
'https://mysite.com', // Your store URL
'ck_xxxxxxxxxxxx', // Your consumer key
'cs_xxxxxxxxxxxxx, // Your consumer secret
[
'wp_api' => true, // Enable the WP REST API integration
'version' => 'wc/v2' // WooCommerce WP REST API version
]
);
$data = [
'name' => 'My New product Name',
'custom_meta' => [
'gb_item_id' => '24680'
]
];
print_r($woocommerce->post('products', $data));
?>
Metadata
Metadata
Assignees
Labels
No labels