Site icon Experience Wordpress Developer Online – Design Develop and Maintenance Support

Move Price under The Title on The Woocommerce Single Product Page

Like WordPress, WooCommerce offer number of action, filters API hook which make it easy to change display order for any section either its On Shop Page, Category Page or on Single Product detail page.

By default, In WooCommerce plugin Product price displays between the product title and product description on the single product page. In Today article, we will show you how you can move Price under the title on The Woocommerce Single Product Page.

To show Price underneath title on Woocommerce Single Product Page add following code in your active theme functions.php file, if already used child theme than add child theme functions.php

/**********************************
*
* Move Price under title on WooCommerce Single Product Page
*
*
* Following hook use with woocommerce_single_product_summary action and their calling priority
*
* @hooked woocommerce_template_single_title – 5
* @hooked woocommerce_template_single_price – 10
* @hooked woocommerce_template_single_excerpt – 20
* @hooked woocommerce_template_single_add_to_cart – 30
* @hooked woocommerce_template_single_meta – 40
* @hooked woocommerce_template_single_sharing – 50
*
************************************/
// To Move price underneath title use code 
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );  
// remove action which show Price on their default location
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 6); 
// add action with Priority just more than the woocommerce_template_single_title 

If want to show Price after Add to Cart button use

// Move price after ADD to Cart Button
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );  

add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 35); 
// add action with high Priority than the woocommerce_template_single_add_to_cart 

To see all action call during display Single Product page look at content-single-product.php file inside WooCommerce/templates folder.

Useful action hook for Single Product page in WooCommerce


// Remove product category/tag meta from its original position
  remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
  // Add product meta in new position
  add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 5 );

  // Remove product title from its original position
  remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
  // Add product title in new position
  add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 10 );

  // Remove product price from its original position
  remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
  // Add product price in new position
  add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 15 );

  /**
  * woocommerce_after_single_product_summary hook
  *
  * @hooked woocommerce_output_product_data_tabs - 10
  * @hooked woocommerce_upsell_display - 15
  * @hooked woocommerce_output_related_products - 20
  */

  // Remove product tabs (description, additional information, reviews)
  remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );

  // Add product description tab content in new position
  function woocommerce_template_product_description() {
  	woocommerce_get_template( 'single-product/tabs/description.php' );
  }
  add_action( 'woocommerce_single_product_summary', 'woocommerce_template_product_description', 20 );

  // Add product additional information tab content in new position
  function woocommerce_template_product_additional() {
    woocommerce_get_template( 'single-product/tabs/additional-information.php' );
  }
  add_action( 'woocommerce_single_product_summary', 'woocommerce_template_product_additional', 30 );

  // Remove product add-to-cart from it original position
  remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
  // Add product add-to-cart in new position
  add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 40 );

  // Remove product 'Related Products'
  remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );

  // Remove shop breadcrumb
  remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );

  // Remove main shop page "Showing X results" text
  remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );

  // Remove main shop page product filter
  remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
Exit mobile version