我使用woocommerce rest api来管理产品和其他东西。 仅使用默认语言,但是我想用其他语言添加该产品,此处是添加产品的代码:
<?php
$data = [
'name' => 'French Test Post',
'type' => 'simple',
'regular_price' => '10.00',
'description' => 'This is a Simple French Test Post',
'short_description' => 'This is a Simple French Test Post',
'lang' => 'fr',
'translation_of' => '144'
];
if($woocommerce->post('products', $data)){
header("Location: http://localhost/wordpress/CorePhp/listallcat.php");
die();
}
else{
echo "error";
}
?>