Map custom WC checkout fields with custom Zoho Sales Order fields.
*Note: in this tutorial, we assume you have already configured Custom Fields in Zoho and in WooCommerce. If not, please follow the Zoho Inventory documentation, as well as install a Checkout Custom Fields plugin in your WooCommerce store.
End result:
Simply fill in the WooCommerce field name on the left side and the Zoho Field Label on the right side and click on save. Voila! Now you have enabled complete orders if you use custom fields!
The payment method is a standard field in Woo and not a custom field, so you will need to create a custom called “payment_method” for the order and then hide it on the Frontend with some CSS.
After that step, simply copy below code and paste it into your child theme – functions.php or custom plugin.
1 2 3 4 5 6 7 | add_action( 'woocommerce_checkout_update_order_meta' , 'my_custom_checkout_field_update_order_meta' ); function my_custom_checkout_field_update_order_meta( $order_id ) { $order = new WC_Order( $order_id ); $method = $order ->get_payment_method(); $order->update_meta_data( 'payment_method' , $method ); $order->save();} |
*Tip: we recommend in changing the function’s name to avoid conflict with other plugins.