Skip to content

Instantly share code, notes, and snippets.

@ScottDeLuzio
Last active December 29, 2017 15:13
Show Gist options
  • Save ScottDeLuzio/0e3709e98f82b29cde070d919af91f81 to your computer and use it in GitHub Desktop.
Save ScottDeLuzio/0e3709e98f82b29cde070d919af91f81 to your computer and use it in GitHub Desktop.
Move Conditional Checkout Fields With WooCommerce Hooks
<?php
/*
* This has not been tested, but should work in theory. Use with care.
*/
/*
* Remove the default WooCommerce Action
* Valid actions include:
* woocommerce_before_checkout_billing_form
* woocommerce_after_checkout_billing_form
* woocommerce_before_checkout_shipping_form
* woocommerce_after_checkout_shipping_form
* woocommerce_before_order_notes
* woocommerce_after_order_notes
* Use the action that is appropriate for the setting selected in WooCommerce > Conditional Fields
*/
remove_action( 'woocommerce_after_order_notes', 'conditional_checkout_field_pro' );
/*
* Add the action back where needed.
* Use the appropriate action from the multistep checkout plugin in the first part (woocommerce_multistep_checkout_before_order_info)
* Use the same function name from above in the second part (conditional_checkout_field_pro) to ensure the correct function is being called here.
*/
add_action( 'woocommerce_multistep_checkout_before_order_info', 'conditional_checkout_field_pro' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment