O /
处理一个小项目,我从管理区域(以编程方式)创建一个WC订单,我想添加一个订单项(非产品/费用在订单创建后,但如何我到底是做什么的呢? 我通过这样做来创建订单:
$address = array(
'first_name' => $sBillingFirstName,
'last_name' => $sBillingLastName,
'company' => $sBillingCompanyName,
'email' => $sBillingEmail,
'phone' => $sBillingPhone,
'address_1' => $sBillingAddress1,
'address_2' => $sBillingAddress2,
'city' => $sBillingCity,
'state' => '',
'postcode' => $sBillingZipcode,
'country' => $sBillingCountry,
);
$oOrder = wc_create_order();
$oOrder->set_address( $address, 'billing' );
$oOrder->set_address( $address, 'shipping' );
通常我会做add_fee,如下所示添加"非产品" lineitem / fee,但因为我没有购物车对象 - 我该怎么做?
wc->cart->add_fee("deposit", 200);
但我没有购物车对象,那么如何在新订单中创建存款呢?