Image Upload

Image Upload for Product & Variation

Image field type is not available for Product & Variation (instead File field could be used).

Image Upload for Admin

Insert a Image uploader field on the Admin Page. Using this field store admin can set custom images to Products, Variation Products and Product Category.

This field utilize WordPress Media Browser to browse or upload images.

This fields cannot be enabled to show on front end product page, only for admins. The value can be retrieved like any other post meta, using get_post_meta() function.

Text Field Configurations for Admin

Option Description
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.
Tips Whether to show the tip icon in the back end.
Description Tool-tip message, when admin user click on the Tips Icon.

How to use

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.

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[0] contains the SRC */
$html = '<img src="'. $img[0] .'" />';

Leave a Reply

Your email address will not be published. Required fields are marked *