0

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.

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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