php - Show regular price in custom place on product page woocommerce
one text
Solution:
I did it. This code show regular price before add to cart in custom category.
add_action('woocommerce_before_add_to_cart_form', 'basic_price', 15 );
function basic_price() {
$price = get_post_meta( get_the_ID(), '_regular_price', true);
$formatted_price = wc_price( $price );
if( has_term( ['laminat'], 'product_cat' ) ) {
echo '<p class="vel_costpack">Стоимость упаковки: <span class="woocommerce-Price-amount amount">'. $formatted_price .'</span></p>'; // Print new html with title and price
}
}
Source