add hidden input field to woocommerce checkout to pass data to payment gateway

1.3k views Asked by At

I have a store running WooCommerce and the client needs us to pass a variable to the payment gateway (WorldPay) that is then included in an payment confirmation email sent form the gateway to the client.

WorldPay say i just need to add this to the form:

<input type="hidden" value="myValue" name="M_myName" />

After a lot of research I figured out how to create an array of the SKUs for each product in the cart. I have created a function that will grab each product SKU and add it to an array. Then outputs this array to replace "myValue" in the above.

My question is where do I need to put the < input >? I have added it to woocommerce > checkout > review-order.php, but this doesn't seem to work. It shows in the front-end but doesn't get passed the WorldPay.

Or would I need to add it to an existing action? I found this which seems to be talking about the similar issue – but then, where would I need to inject the output of that action, in which template?

Thanks for any advice.

0

There are 0 answers