WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In wp-ecomemrce I have added a new field in the checkout to capture the company name. I need to get the data from the transaction but how? I am not sure how the form fields are stored to be able to retrieve them.

share|improve this question
up vote 0 down vote accepted

Managed to figure it out. The pdf output code has this to get the normal field values:

$form_sql = "SELECT * FROM `".$wpdb->prefix."wpsc_submited_form_data` LEFT JOIN `".$wpdb->prefix."wpsc_checkout_forms` ON ".$wpdb->prefix."wpsc_submited_form_data.form_id = ".$wpdb->prefix."wpsc_checkout_forms.id WHERE  `log_id` = '".(int)$purchase_id."' AND `active` = '1'";

    $input_data = $wpdb->get_results($form_sql,ARRAY_A);

The there is a switch statement based ont he unique_name but as this is a custom field it does not have a unique name. I added a loop at the top top loop through and look for the form_field id instead which i got from the database (21 i8n this case) and then I was able to use an if statement to check for the id and output it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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