Woocommerce快速结账表格

时间:2016-10-29 05:20:16

标签: wordpress woocommerce customization checkout

我想在woocommerce的产品详细信息页面中添加结帐表单,在产品页面的任何人填写表单和下订单我想在单个产品页面上添加自定义快速结帐表单这里是参考看图像{ {3}}

1 个答案:

答案 0 :(得分:0)

您可以通过编程方式创建订单。使用下面的东西。请根据您的需要调整脚本。

$ order_args = array(

                  'status'        => '',

                  'customer_id'   => get_current_user_id(),

                  'customer_note' => null,

                  'order_id'      => 0,

                  'created_via'   => '',

                  'parent'        => 0
           );

           $order = wc_create_order( $order_args );

           $order->add_product($postsale_product, $order_qty, $product_args);

           $order->set_address($original_order->get_address('billing'), 'billing');

           $order->set_address($original_order->get_address('shipping'), 'shipping');

           $order->set_total($order_total);

           $order->add_order_note('Upsell order');

           $order->set_payment_method($payment_method);

           $order->calculate_shipping();

           $order->calculate_taxes();

           $order->calculate_totals();
相关问题