我是用wc_create_order
这是完整的代码
`如果(isset($\\u POST[\'submitted\'])){
$address = array(
\'first_name\' => $_POST[\'fullname\'],
\'email\' => $_POST[\'email\'],
\'phone\' => $_POST[\'phone\'],
\'address_1\' => $_POST[\'address\'],
\'city\' => $_POST[\'city\'],
);
$order = wc_create_order();
$order->add_product( get_product( get_the_id() ), $_POST[\'quantity\'] );
$order->set_address( $address, \'billing\' );
$order->set_address( $address, \'shipping\' );
$order->set_payment_method( \'cod\' );
$order->calculate_totals();
}`