如何在特定客户下创建新的woo-commerce订单?

时间:2016-12-23 05:39:27

标签: php wordpress woocommerce

我正在使用此功能创建新的woocommerce订单WC()->checkout()->create_order($order_data);在来宾用户下创建的订单。我想在现有客户下创建订单,因为我可以传递客户ID。检查下面的订单数据

array(
    'order' => array(
        'payment_details' => array(
            'method_id' => 'bacs',
            'method_title' => 'Direct Bank Transfer',
            'paid' => true
        ),
        'billing_address' => array(
            'first_name' => 'John',
            'last_name' => 'Doe',
            'address_1' => '969 Market',
            'address_2' => '',
            'city' => 'San Francisco',
            'state' => 'CA',
            'postcode' => '94103',
            'country' => 'US',
            'email' => 'john.doe@example.com',
            'phone' => '(555) 555-5555'
        ),
        'shipping_address' => array(
            'first_name' => 'John',
            'last_name' => 'Doe',
            'address_1' => '969 Market',
            'address_2' => '',
            'city' => 'San Francisco',
            'state' => 'CA',
            'postcode' => '94103',
            'country' => 'US'
        ),
        'customer_id' => 114,
        'line_items' => array(
            array(
                'product_id' => 546,
                'quantity' => 2
            ),
            array(
                'product_id' => 613,
                'quantity' => 1,
                'variations' => array(
                    'pa_color' => 'Black'
                )
            )
        ),
        'shipping_lines' => array(
            array(
                'method_id' => 'flat_rate',
                'method_title' => 'Flat Rate',
                'total' => 10
            )
        )
    )
)

0 个答案:

没有答案