Custom field in Marketpress Shipping page

Hi, we are creating a MarketPress plugin that adds additional options to the shipping page and have hit a few road blocks.

Does anyone have working code that we can look at and learn from, that adds a text field or other option to the shipping page and stores it with the order? Any assistance would be appreciated.

  • S H Mohanjith
    • Developer

    You can hook onto the ‘mp_checkout_shipping_field’ action (see marketpress-includes/template-functions.php line 484) to add a field to the shipping form and you can hook onto the ‘mp_shipping_process’ action to process the shipping form.

    Hope this answers your question.

    Please note we will be changing ‘mp_checkout_shipping_field’ to a filter in an upcoming release.

  • jseigle85
    • Design Lord, Child of Thor

    I am trying to add a custom field to the checkout page. I open and edit the marketpress-includes/template-functions.php file and edit the file by adding some code into the ” mp_shipping_form “

    When I added my line of code it successfully added a custom field for me which I named IMEI. how ever I am having problems. I will explain the problem, but first here is the code I added:

    if ($editable) {

    $content .= ‘<form id=”mp_shipping_form” method=”post” action=””>’;

    $content .= apply_filters( ‘mp_checkout_before_shipping’, ” );

    $content .= ‘<table class=”mp_cart_shipping”>’;

    $content .= ‘<thead><tr>’;

    $content .= ‘<th colspan=”2″>’.__(‘Enter Your Shipping Information:’, ‘mp’:wink:.'</th>’;

    $content .= ‘</tr></thead>’;

    $content .= ‘<tbody>’;

    $content .= ‘<tr>’;

    $content .= ‘<td align=”right”>’.__(‘Email:’, ‘mp’:wink:.’*</td><td>’;

    $content .= apply_filters( ‘mp_checkout_error_email’, ” );

    $content .= ‘<input size=”35″ name=”email” type=”text” value=”‘.esc_attr($email).'” /></td>’;

    $content .= ‘</tr>’;

    $content .= ‘<tr>’;

    $content .= ‘<td align=”right”>’. __(‘Full Name:’, ‘mp’:wink:.’*</td><td>’;

    $content .= apply_filters( ‘mp_checkout_error_name’, ” );

    $content .= ‘<input size=”35″ name=”name” type=”text” value=”‘.esc_attr($name).'” /> </td>’;

    $content .= ‘</tr>’;

    $content .= ‘<tr>’;

    $content .= ‘<td align=”right”>’. __(‘Address:’, ‘mp’:wink:.’*</td><td>’;

    $content .= apply_filters( ‘mp_checkout_error_address1’, ” );

    $content .= ‘<input size=”45″ name=”address1″ type=”text” value=”‘.esc_attr($address1).'” />

    $content .= ‘<small>‘. __(‘Street address, P.O. box, company name, c/o’, ‘mp’:wink:.’</small>’;

    $content .= ‘</td>’;

    $content .= ‘</tr>’;

    $content .= ‘<tr>’;

    $content .= ‘<td align=”right”>’. __(‘Address 2:’, ‘mp’:wink:.’ </td><td>’;

    $content .= ‘<input size=”45″ name=”address2″ type=”text” value=”‘.esc_attr($address2).'” />

    $content .= ‘<small>‘.__(‘Apartment, suite, unit, building, floor, etc.’, ‘mp’:wink:.’</small>’;

    $content .= ‘</td>’;

    $content .= ‘</tr>’;

    $content .= ‘<tr>’;

    $content .= ‘<td align=”right”>’.__(‘City:’, ‘mp’:wink:.’*</td><td>’;

    $content .= apply_filters( ‘mp_checkout_error_city’, ” );

    $content .= ‘<input size=”25″ name=”city” type=”text” value=”‘.esc_attr($city).'” /></td>’;

    $content .= ‘</tr>’;

    $content .= ‘<tr>’;

    $content .= ‘<td align=”right”>’.__(‘State/Province/Region:’, ‘mp’:wink:.’*</td><td>’;

    $content .= apply_filters( ‘mp_checkout_error_state’, ” );

    $content .= ‘<input size=”15″ name=”state” type=”text” value=”‘.esc_attr($state).'” /></td>’;

    $content .= ‘</tr>’;

    $content .= ‘<tr>’;

    $content .= ‘<td align=”right”>’.__(‘Postal/Zip Code:’, ‘mp’:wink:.’*</td><td>’;

    $content .= apply_filters( ‘mp_checkout_error_zip’, ” );

    $content .= ‘<input size=”10″ id=”mp_zip” name=”zip” type=”text” value=”‘.esc_attr($zip).'” /></td>’;

    $content .= ‘</tr>’;

    $content .= ‘<tr>’;

    $content .= ‘<td align=”right”>’. __(‘IMEI:’, ‘mp’:wink:.’*</td><td>’;

    $content .= apply_filters( ‘mp_checkout_error_imei’, ” );

    $content .= ‘<input size=”35″ name=”imei” type=”text” value=”‘.esc_attr($imei).'” /> </td>’;

    $content .= ‘</tr>’;

    $content .= ‘<tr>’;

    $content .= ‘<td align=”right”>’.__(‘Country:’, ‘mp’:wink:.’*</td><td>’;

    There is more of the code but to save space I stopped here. This form does have a closing tag just not here to save space!

    Here Is my problem:

    As I stated before if you go to the shopping cart and checkout you will see the custom field add name IMEI on the checkout page. This is successful, but after checkout is complete and you go to the admin area to manage orders under the shipping information I do not see the label IMEI or the information from that custom field. This is the only thing I see:

    Full Name: John Berry


    Address: 163 man Way Dr

    City: Queens

    State/Province/Region: SC

    Postal/Zip Code: 29878

    Country: United States

    Phone Number: 7049785236

    It is not showing IMEI


    in the same file I added the custom field I see $_SESSION[‘mp_shipping_info’ so I added this code in the area thinking it would save the information

    $meta = get_user_meta($current_user->ID, ‘mp_shipping_info’, true);

    //get address

    $email = (!empty($_SESSION)) ? $_SESSION : (isset($meta) ? $meta: $current_user->user_email);

    $name = (!empty($_SESSION)) ? $_SESSION : (isset($meta) ? $meta : $current_user->user_firstname . ‘ ‘ . $current_user->user_lastname);

    $address1 = (!empty($_SESSION)) ? $_SESSION : $meta;

    $address2 = (!empty($_SESSION)) ? $_SESSION : $meta;

    $city = (!empty($_SESSION)) ? $_SESSION : $meta;

    $state = (!empty($_SESSION)) ? $_SESSION : $meta;

    $zip = (!empty($_SESSION)) ? $_SESSION : $meta;

    $imei = (!empty($_SESSION)) ? $_SESSION : $meta;

    $country = (!empty($_SESSION)) ? $_SESSION : $meta;

    if (!$country)

    $country = $settings;

    $phone = (!empty($_SESSION)) ? $_SESSION : $meta;

    $content = ”;

    //don’t show if logged in

    if (!is_user_logged_in() && $editable) {

    $content .= ‘<p class=”mp_cart_login_msg”>’;

    $content .= __(‘Made a purchase here before?’, ‘mp’:wink:.’ ‘.__(‘Login now to retrieve your saved info »’, ‘mp’:wink:.’‘;

    $content .= ‘</p>’;


    Can you please tell me where I am going wrong? Can you tell me how to make the IMEI show up in the admin area. Please provide coding. If you provide coding I need to know what file to edit and what lines to insert the code on. example on line 450 add <?php code here?>

  • DavidM
    • DEV MAN’s Mascot

    Hi jseigle85,

    I’ve responded to your prior post on this matter at the following:

    Currently you’re editing the MarketPress template function whereas it’s much easier and more efficient to write your own plugin. I’ve covered a couple of things to that effect in the other thread but ultimately, this falls outside the realm of what we can feasibly provide for in support.

    It’s something you’ll likely want to find a developer to code.

    Or as elsewhere mentioned, you could add your vote to threads such as the following:



  • aristath
    • Recruit

    Hey there!

    You can use the MP Custom Shipping Form plugin if you want.

    You can get it from here:

    Since this is a 3-year-old post I will close this to avoid further posts. There’s no reason people that posted here 3 years ago to get emails on their inbox for this…

    If the plugin I posted above doesn’t do what you need you can simply open up a new thread in these forums instead of posting here.



Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.