0

Given the following code:

<form>
    <h1> My form <h1>
    <input type="text" />
    <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
</form>

How can I locate the "woocomerce_checkout_after_customer_details" defined?

It prints a button where I have to add functionality, maybe can I just use add_action() to add new features? in that case: how can I use remove_action() to stop rendering the old button?

Thanks in advance

0

You can find out what actions are assigned to given hook with this code:

function print_filters_for( $hook = '' ) {
    global $wp_filter;
    if( empty( $hook ) || ! array_key_exists( $hook, $wp_filter ) ) {
        return;
    }

    print '<pre>';
    print_r( $wp_filter[$hook] );
    print '</pre>';
}

Call it where you need it. In your case:

<form>
    <h1> My form <h1>
    <input type="text" />
    <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
    print_filters_for( 'woocommerce_checkout_after_customer_details' );
</form>
| improve this answer | |
  • Is this considered good practice here to flag as duplicate and cross-post the answer? – kero Nov 23 '18 at 10:03
  • 1
    @kero hard to say. It’s not exactly duplicate, so I’ve added answer as quick help... But in the long run it should be closed, I guess. – Krzysiek Dróżdż Nov 23 '18 at 10:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.