Custom checkout field in order review table
-
I’m building a custom shipping method plugin for WooCommerce to let customers choosing a shipping address from an external API when a particular shipping method is selected. The field is populated by jQuery when customer clicks the button “Choose this address” in a popup.
The custom field is positioned in the Order Review table, under the row where to select the shipping method. Here comes the problem: editing some other checkout fields reloads the content of this table, loosing the content of the choosen custom shipping address field.
I was able to pass the variable to WC session in a validate function and maintaining the field content but this is not the best solution: in this way I can save in session the variable only when customer clicks the “Place Order” button. So I was able to set a cookie with jquery and maintain the field content without problems but… I was asking to myself if there is a solution to pass the variable to session when the order review is reloading.
I found this hook: woocommerce_checkout_update_order_review but I’m not sure :
1. if it’s the right hook to use for my scope;
2. how to use itIs someone so kind to give me an example to solve the situation? Thanks for any help.
- The topic ‘Custom checkout field in order review table’ is closed to new replies.