我正在使用wc_create_order()
以编程方式创建订单,而我无法找到为订单设置折扣的方法,例如
$order = wc_create_order();
$sub_total = $_POST['totals']['totalBefore'];
$discount = $_POST['totals']['discount'];
$order->set_discount( $discount ); //this function doesn't exit, need something to do that work
$order->set_total( $sub_total - $discount );
知道我是怎么做到的吗?