0

I want to do a very very simple thing : To re-order the display of the rating and price information on a WooCommerce product category loop. Now in the product category page I got 5 products, all of the same layout:

--THUMBNAIL--
| Product name
| Rating
| Price
| Add to Cart

Now I just want to make it like this:

--THUMBNAIL--
| Product name
| Price
| Rating
| Add to Cart

I know the code just lies somewhere between the hooks; but just cannot find anyway to make it work. If anyone has ever dealt with this problem, please help show me a way to work with this. I would appreciate this very very very much.

Thank you.

  • In your example they are both the same...what changed? – user23654 Aug 29 '13 at 16:23
  • WooCommerce category loop is handled by WooCommerce standard template or by template in your theme? If so, you should post the code used. – gmazzap Aug 29 '13 at 17:18
  • @splashingpixels Yes that was my typing fault, I edited the post. Your answer worked for me. Thanks. – joshcayenne Aug 29 '13 at 17:37
  • @G.M. Thanks for stopping by. I have only used standard WooCommerce template so far. – joshcayenne Aug 29 '13 at 17:38
0

For example you just want to swap rating and price where price would come before rating, you would do the following.

remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );

add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 11 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 12 );

Put these lines of code in your theme's functions.php file.

  • Excellent. Works like a charm. I think I gotta spend more times on this hookie thing. Thank you very much! – joshcayenne Aug 29 '13 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.