• paxton111

    (@paxton111)


    I want to include a link to a profile of the current user who submitted a checkout form.

    That is, to place automatically a current user’s author link like this in the hidden field: example.com/author/username

    I want to achieve this by adding a hidden field in checkout form. So to get a link I would write something likes this:

    <?php

    $currentUser = get_current_user_id();

    $user = get_user_by( ‘id’, $currentUser );

    $userUrl = get_bloginfo(‘home’).’/author/’.$user->user_login;

    echo $userUrl;
    ?>

    My question is how can I create this hidden field in checkout form and also how to include this field on order page and emails?

    Thanks

    • This topic was modified 8 years ago by paxton111.
Viewing 1 replies (of 1 total)
  • kursora

    (@kursora)

    You must use hooks (actions/filters). woocommerce_checkout_update_order_meta – to store metadata for order, woocommerce_email_order_meta – to include what you want to emails.

Viewing 1 replies (of 1 total)
  • The topic ‘How to create a hidden checkout field?’ is closed to new replies.