After looking at the hooks used, the title has priority 5 and the price has priority 10. So, I did an remove_action
and add_action
and changed it to 6
. That did not work.
What I need is this:
Product title: currency symbol price
Example:
Puzzle for kids: $29
The code I tried:
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 6 );
I have tried this code as well now without any luck:
remove_action('woocommerce_single_product_summary','woocommerce_template_single_title', 5);
add_action('woocommerce_single_product_summary', 'woocommerce_new_single_title', 5);
if ( ! function_exists( 'woocommerce_new_single_title' ) ) {
function woocommerce_new_single_title() {
$product = wc_get_product( $post_id );
$product->get_regular_price();
$product->get_sale_price();
$product->get_price();
$pprice = $product->get_price();
?>
<h1 itemprop="name" class="product_title entry-title"><span><?php the_title(); ?>: <?php $product->get_price(); ?></span></h1>
<?php
}
}
Any ideas where I am going wrong and how to fix this?