WooCommerce REST API创建的订单不包括总税价?

时间:2019-01-09 13:08:24

标签: php woocommerce wordpress-rest-api

我正试图向我的WooCommerce REST API添加税额以创建新订单,但无法正常工作。

$order_data = [
    'payment_method' => 'COD',
    'payment_method_title' => 'Cash on delivery',
    'set_paid' => true,
    'line_items' => '1',
    'customer_id' => '1111',
    'total' => 250,
    'shipping_lines' => [
        [
            'method_id' => 'flat_rate',
            'method_title' => 'Flat Rate',
            'total' => 50
        ]
    ],
    'tax' => [
        'total_tax' => '100',
    ]
];



$data = $woocommerce->post('orders', $order_data);

1 个答案:

答案 0 :(得分:0)

税收的属性是“ tax_lines”而不是“ tax”,请参见:https://woocommerce.github.io/woocommerce-rest-api-docs/v3.html#orders-properties

...
],   
'tax_lines' => [
    'total_tax' => '100',
]