好日子,我一直试图弄清楚如何使用php以编程方式选择配送类。我正在使用表单从前端创建woocommerce产品,并在表单提交时创建产品,但我可以选择任何运输类。下面的屏幕截图显示了从前端创建的产品上的送货类设置,并用ids元素选项卡显示配送类的ids(作为值)。
我使用下面的代码来选择电话托运费类别
$pShipping_Class = 25; //Where 25 is the id/value for Phone Shipping Fee Class
update_post_meta( $product_id, 'product_shipping_class',
我想要创建一个条形订单,但是当我将运费添加到数组中时,它会给出以下错误:
反应体
{
"error": {
"message": "Items of type `shipping` are not supported at order creation.",
"param": "items[2]",
"type": "invalid_request_error"
}
}
请求后体
{
"items": {
"0