问题描述
我在使用WooCommerce Rest API和WPML为产品创建翻译时遇到问题。问题是我创建的翻译产品未链接到原始产品。假设不是为产品创建翻译,而是以默认语言创建一个全新的产品。
var myHeaders = new Headers();
myHeaders.append("Content-Type","application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("translation_of","354");
urlencoded.append("name","محصول عربی");
urlencoded.append("lang","ar");
urlencoded.append("type","simple");
var requestOptions = {
method: 'POST',headers: myHeaders,body: urlencoded,redirect: 'follow'
};
fetch("https://domain.localhost/wp-json/wc/v3/products?consumer_key=ck_key&consumer_secret=cs_secret",requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error',error));
结果如下:
在“产品”列表中,我们将它们并排放置:)
我想念什么?为什么不进行翻译而是创建新产品?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)