Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.