Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Woocommerce: How to reorder single page hooks?

Tags:

woocommerce

I'm working on a Woocommerce-based site and now I'm on the single page. My doubt is how to reorder some hooks there. Originally, we have this order (priority):

<?php 
/*
  * @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
*/
?>

According to my layout, I need to put the elements on this exactly order:

1: Title
2: Name of the product category (last level category where that product was classified in the admin)
3: Quantity switch and "add to cart" button
4 and last: Description

How can I redefine this on my "functions" file in my theme? Any ideas?

like image 212
joaogdesigner Avatar asked Dec 16 '22 08:12

joaogdesigner


1 Answers

This was so long ago but in case anyone is interested, in functions.php file remove and add your own action to reorder contents of single product summary:

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40);
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 5 );
like image 119
amespower Avatar answered Jun 23 '23 07:06

amespower