Upload field validation on checkout page.
-
My problem is, to set false once I have uploaded a file.
//Other way to add an upload field in shipping fields group and hook it into Shipping Field Group. I preferred it.
add_filter( ‘woocommerce_shipping_fields’, ‘woo_filter_upload_shipping’ );function woo_filter_upload_shipping( $address_fields ) {
$address_fields[‘file_upload’] = array(
// if I set label for this field, it does work in validation mean but it does not allow me to proceed once I uploaded a file.
//’label’ => __(‘Upload your ID’, ‘woocommerce’),
‘required’ => false,
‘class’ => array(‘form-row-wide’),
‘clear’ => true
);return $address_fields;
}// Write a function to add an upload file field after order notes textbox.
function add_file_field(){$uploadFile = “”;
$uploadFile .='<div id=”upload_CNIC_image”>’;
$uploadFile .='<input id=”file_upload” name=”file_upload” type=”file” multiple=”true”>’;
$uploadFile .='<span id=”uploadComplete”>’;
$uploadFile .='</span>’;
$uploadFile .='</div>’;
echo $uploadFile;
}
add_action(‘woocommerce_after_order_notes’,’add_file_field’);I used uploadify class to incorporate a upload file functionality on checkout page.
Quick answer will be highly appreciated.
Regards,
Imran Javed
- The topic ‘Upload field validation on checkout page.’ is closed to new replies.