single product page hhoks code example

Example: product title with price in product page hook

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

function show_title_with_price()
{
    global $product;
    $title = $product->get_title();
    $price = $product->get_regular_price();
    $symbol = get_woocommerce_currency_symbol();

    //You may change <p> tag or add any inline CSS here.
    echo "<p>$title: $symbol $price</p>";
}

add_action( 'woocommerce_single_product_summary', 'show_title_with_price', 5 );

Tags:

Misc Example