question regarding Woocommerce payment gateways.
I’ve customized a payment gateway to take purchase orders, and its loading correctly from a plugin, and appearing on the checkout page the way id like it to; I think its a pretty good start.
Anyway, I have a non-standard form entry (purchase order number) that id like people to fill out, but I don’t know how to attach it to my custom payment gateway so that it appears on the resulting admin side page.
This all works fine:
function payment_fields(){
if ( $description = $this->get_description() )
echo wpautop( wptexturize( $description ) );
global $woocommerce;
?>
<form class="form-horizontal" role="form" id="bv-form">
<fieldset>
<!-- Form Name -->
<legend>Purchase Order</legend>
<!-- Text input-->
<div class="form-group">
<label class="control-label" for="po_no">PO Number</label>
<div class="">
<input id="po_no" name="po_no" type="text" placeholder="" class="form-control input-md">
</div>
</div>
...
But when I get here, I don’t know how to modify process_payment( $order_id )
(or what to add to functions.php
) to grab the form values from the payment fields. I see that there are $order->billingAddress1
etc., how would I submit the extra couple form fields along with the order, and then secondly, how would I access that to get po_no
out of the newly created WC_Order
?
- WP: 3.9.2
- WC: 2.1.11
Thanks for your help!