Summary
A PPOM file-upload (or cropper) field with no File types value throws an uncaught JS error while plupload initializes on the product page. The uploader is never constructed, so the "Select files" button does nothing.
Uncaught TypeError: Cannot read properties of undefined (reading 'split')
at plupload.min.js?ver=2.1.9:1:6626
at ppom_setup_file_upload_input (file-upload.js:557)
at file-upload.js:337
Steps to reproduce
- On a product, add a File Upload field via the field modal and leave File types empty.
- Save and open the product page on the front end.
- Actual: console
TypeError on load; the button does nothing. Expected: file picker opens.
Workaround: set File types on the field to any value (e.g. jpg,png,gif,pdf,zip).
Root cause
The uploader reads its config from ppom_input_vars.ppom_inputs, built by Settings::get_js_input_vars(), which passes raw field meta through — the per-type switch defaults daterange/color/bulkquantity but not file/cropper (src/Arrays/Settings.php:551-607). plupload then receives extensions: file_input.file_types (js/file-upload.js:571); when that's undefined it calls .split() on it and throws inside new plupload.Uploader(...), aborting construction. (file_size being empty is harmless — only file_types crashes.)
Proposed fix
Default file_types/file_size for file/cropper in the same switch that already defaults other types — fixes existing saved fields too, no build step:
// src/Arrays/Settings.php — inside switch ( $type )
case 'file':
case 'cropper':
if ( empty( $fields_meta['file_types'] ) ) {
$fields_meta['file_types'] = 'jpg,pdf,zip';
}
if ( empty( $fields_meta['file_size'] ) ) {
$fields_meta['file_size'] = '1mb';
}
break;
Optional guard in js/file-upload.js:571:
{ title: 'Filetypes', extensions: file_input.file_types || 'jpg,png,gif' },
Summary
A PPOM file-upload (or cropper) field with no File types value throws an uncaught JS error while plupload initializes on the product page. The uploader is never constructed, so the "Select files" button does nothing.
Steps to reproduce
TypeErroron load; the button does nothing. Expected: file picker opens.Workaround: set File types on the field to any value (e.g.
jpg,png,gif,pdf,zip).Root cause
The uploader reads its config from
ppom_input_vars.ppom_inputs, built bySettings::get_js_input_vars(), which passes raw field meta through — the per-type switch defaultsdaterange/color/bulkquantitybut notfile/cropper(src/Arrays/Settings.php:551-607). plupload then receivesextensions: file_input.file_types(js/file-upload.js:571); when that's undefined it calls.split()on it and throws insidenew plupload.Uploader(...), aborting construction. (file_sizebeing empty is harmless — onlyfile_typescrashes.)Proposed fix
Default
file_types/file_sizefor file/cropper in the same switch that already defaults other types — fixes existing saved fields too, no build step:Optional guard in
js/file-upload.js:571: