Can get custom fields to display using get post meta.
-
I’ve tried absolutely everything to get the custom fields I added on my product edit page to display on the product short description page. I’ve set a custom template using the short-description under woocommerce to no avail. I’ve tried what everyone has posted on their sites to display post meta. I’ve tried the wordpress custom fields get post meta. I just cant get anything to work. Shown below is one of the custom fields I’ve set. I’m trying to get it to show on the product description as a unordered list. If someone can tell me how to do this using the info below and tell me where to put it I’d appreciate it. I need this weeks ago. Thanks….
// Display Fields
add_action( ‘woocommerce_product_options_general_product_data’, ‘woo_add_custom_general_fields’ );
// Save Fields
add_action( ‘woocommerce_process_product_meta’,‘woo_add_custom_general_fields_save’ );
function woo_add_custom_general_fields() {
global $woocommerce, $post;echo ‘<div class=”options_group”>’;
// Text Field
woocommerce_wp_text_input(
array(
‘id’ => ‘_manufacturertext_field’,
‘label’ => __( ‘Manufacturer’, ‘woocommerce’ ),
‘placeholder’ => ”,
‘desc_tip’ => ‘true’,
‘description’ => __( ‘manufacturer’, ‘woocommerce’ )
)
);
echo ‘</div>’;
}
function woo_add_custom_general_fields_save( $post_id ){// Text Field
$woocommerce_text_field = $_POST[‘_manufacturertext_field’];
if( !empty( $woocommerce_text_field ) )
update_post_meta( $post_id, ‘_manufacturertext_field’, esc_attr( $woocommerce_text_field ) );
}
- The topic ‘Can get custom fields to display using get post meta.’ is closed to new replies.