Image field type not available for Product Page (instead File field could be used).
Insert a Image uploader field on the Admin Page. Using this field strore admin can set custom images to Products, Variation Products and Product Category.
This field utilize WordPress Media Browser to browse or upload images.
|Button Text||Uploader button label’s text.|
|Probe Text||Description for this image uploader.|
|Media Browser Title||Descriptive title for the WordPress Media Browser.|
|Required||Make this image field mandatory – user cannot perform create or update operation on without choosing any image.|
|Message||Message that has to be displayed when validation failed for this field.|
How to use this field
This field will store the image’s attachment id as the value. like every other custom admin fields, this also will be stored as Custom Post Meta. Where the meta key would be the name of the field itself with “wccaf_” as prefix.
If you wanted to use this field’s value (I mean you wanted to retrieve the image) here is the snippet.
/** * $_post_id would be the Product Id * Note: Post meta key is the field's name itself with "wccaf_" as prefix */ $attachment_id = get_post_meta($_post_id, "wccaf_your_image_field_name", true); /* Use the following if you want the image with img tag wrapped */ $img_html = wp_get_attachment_image($attachment_id, 'full'); /* Use the following if you want only the attachment URL */ $img = wp_get_attachment_image_src($attachment_id, 'full'); /* $img contains the SRC */ $html = '<img src="'. $img .'" />';