This is something that has been doing my head in and I can't seem to find exactly what I want on here.
I am trying to move the price on my product pages to display just above or beside the add to cart button.
Page link for a product is here
I have played around with this before, and managed to create a second price in the position I wanted, but still had the original price at the top and couldn't get rid of it.
How can I achieve this?
Thanks
This will work just for simple products as variable products displays already their live price above the Add-to-cart button.
This is the code you need:
function changing_price_location_for_simple_products(){
global $product;
if($product->is_type('simple')) // Only for simple products (thanks to helgathevicking)
{
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 10);
add_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 25);
}
}
add_action('woocommerce_before_single_product', 'changing_price_location_for_simple_products');
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
The code is tested and works.