hook - Woocommerce - Append custom field after price in content-single-product.php -


i need append custom field called unit_description after price read e.g. $7.00 per sandwich.

i'm thinking begin with:

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); 

try this:

add_filter( 'woocommerce_price_format', 'overwrite_woocommerce_price_format', 10, 2 );  function overwrite_woocommerce_price_format( $format, $currency_pos ) {     global $post;     if ( $post->post_type != 'product' ) return $format;     $custom_field = get_post_meta( $post->id, 'unit_description', true );   // return custom field value     return $format . ' ' . __( $custom_field, 'woocommerce' );  // here you'll append custom field price } 

hope helpful


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -