产品未添加其他语言woocommerce rest api和ploylang

时间:2018-07-31 11:29:10

标签: wordpress woocommerce woocommerce-rest-api

我使用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";
}
?>

0 个答案:

没有答案