0

I need to add a form after closing form tag in woocommerce admin order edit page. I need to do this because the action of this form points to an iframe...

ex:

<form action='someurl.com' target='myiframe'>
   <input type='hidden' value='myvalue' /> 
</form>
<iframe id='myiframe' src='someurl.com'></iframe>

I need to put anywhere in order details admin page... I researching by two days.. the only way i found is in the admin_footer, but the layout breaks.

with admin_footer hook the there are two or three div.clear between the default form and my form...

I'm asking this here because i think it is just a custom post type... if doesn't i'm sorry for that.

I'm thinking in place this form in order list admin page!!! anyone can help me?

thanks for helping!

1

You can use the other action which called before wp_footer. You can use action "in_admin_footer"

// define the in_admin_footer callback 
function action_in_admin_footer() { 
    global $pagenow, $current_page, $post;

    //$current_page->post_type === 'shop_order' 

    if( $pagenow == 'post.php' && !empty( $_GET['action'] ) && $_GET['action'] == 'edit' && $post->post_type == 'shop_order' ) {
        // make action magic happen here... 
    }
}; 

// add the action 
add_action( 'in_admin_footer', 'action_in_admin_footer' ); 
  • this seems to work better... the layout brakes too, but i will try to add html to adjust... I need to test if I'm in order edit page too beacuse it appears in other admin pages.. if i got it i'll vote as resolved.. thanks for now – Reculos Gerbi Neto Feb 19 '20 at 13:38
  • Yes. It needs some adjustment also check the page conditions and post type. Because that will display on all the backend pages. So you should have add conditions for that. If you need more detailed code then I can provide you as well.. – Dipendra Pancholi Feb 19 '20 at 13:44
  • is this the rigth way to check? $current_page->post_type === 'shop_order' && isset( $_GET[ 'action' ]) && $_GET[ 'action' ] === 'edit' – Reculos Gerbi Neto Feb 19 '20 at 13:50
  • Updated code: ``` // define the in_admin_footer callback function action_in_admin_footer() { global $pagenow; if( $pagenow == 'post.php' && !empty( $_GET['action'] ) && $_GET['action'] == 'edit' ) { // make action magic happen here... } }; // add the action add_action( 'in_admin_footer', 'action_in_admin_footer' ); ``` – Dipendra Pancholi Feb 19 '20 at 14:27
  • I think I need to add this in another answer... let me add that – Dipendra Pancholi Feb 19 '20 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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