Step 1:
Add meta data via custom field either by hand or in bulk via a csv-file.
Every column in a csv file named `meta:my_custom_field` will generate a, surprise, custom field named just like that. See documentation:
Column names prefixed with
meta:
will get automatically mapped as meta data to import. For example, if you have a column namedmeta:product_depth
the values of that column will get imported and saved as meta data under the „product_depth“ key.
Step 2:
Add this snippet in your template file by using the get_post_meta function:
<?php
$custom_field = get_post_meta(
$product->get_id(), 'custom_field_name', true
);
if (is_string( $custom_field ) ) {
echo wp_kses_post( "My custom field: $custom_field" );
};
?>
Ein Kommentar