Search code examples
woocommercehook-woocommerce

Move woocommerce products prices above the products titles in shop page


Good morning. I need to move the prices contained in the cards above the titles in the main shop pages and consequently the category too. I mean not the single page where you see the product itself, but the /shop page where all the products are listed. i don't really know the hook to use and priority to set. Thank you for your help.


Solution

  • It depends on your theme, but if everything is by default, this is the code you need:

    add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
    remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
    

    Code goes in functions.php file of your active theme/child theme. Tested and works.