0

How it is possible to change the sequence of Product Title, Price and Description on shop catalog page in Woocommerce?

There is my code:

<?php

if ( ! defined( 'ABSPATH' ) ) {
 exit; // Exit if accessed directly
}

//Remove Single Product Hooks
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );

//Add Single Product Hooks
add_action( 'woocommerce_single_product_summary', 'blade_grve_woo_single_title', 5 );
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );

?>

<?php
  do_action( 'woocommerce_before_single_product' );

  if ( post_password_required() ) {
   echo get_the_password_form();
   return;
  }

?>

<?php if ( function_exists( 'wc_product_class' ) ) { ?>
<div id="product-<?php the_ID(); ?>" <?php wc_product_class(); ?>>
<?php } else { ?>
<div id="product-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php }  ?>

 <div class="grve-container">
  <?php
   do_action( 'woocommerce_before_single_product_summary' );
  ?>

  <div id="grve-entry-summary" class="summary entry-summary grve-bookmark">

   <?php
    do_action( 'woocommerce_single_product_summary' );
   ?>

  </div><!-- .summary -->
 </div>

 <?php
  do_action( 'woocommerce_after_single_product_summary' );
 ?>

</div><!-- #product-<?php the_ID(); ?> -->

<?php do_action( 'woocommerce_after_single_product' );

Im not good in PHP, but i want to show the title first (on the top of the loop). What could i do?

Thanks in advance!

walacky
  • 35
  • 10

1 Answers1

0

If you're referring to the single product page here is a list of functions that are hooked into this action.

/**
 * Product Summary Box.
 *
 * @see woocommerce_template_single_title()
 * @see woocommerce_template_single_rating()
 * @see woocommerce_template_single_price()
 * @see woocommerce_template_single_excerpt()
 * @see woocommerce_template_single_meta()
 * @see woocommerce_template_single_sharing()
 */
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );

To change the order, go into your functions.php and add or remove certain functions from the action with different priorities. This will place the product summary after the title but before the rating and price.

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 7 );
Aaron
  • 179
  • 9