Archived topic
Move price on product category
5 replies · Started by Jamal on July 3, 2017
Hi
I will repost my question here in the hope someone can help me figure this out.
How can i move the product price on category page to right after the title and before product description? Right now i have it like below
woocommerce-loop-product__title
woocommerce-product-details__short-description
priceThanks
Just to clarify more i will be most happy if i can make it look like on the single product
http://imgur.com/wk1Do1I
Hi Jamal - maybe this might help. What i wanted was a trimmed short description, so i hid the default short description and hooked in my trimmed description below the price. You could do the same thing.
/* Adding excerpt to shop page */
add_action( 'woocommerce_after_shop_loop_item', 'diggs_custom_shop_item', 5);
function diggs_custom_shop_item() {
global $post;
/* product excerpt */
if ( $post->post_excerpt ) {
echo '<div class="diggs-shop-excerpt">' . apply_filters( 'woocommerce_short_description', wp_trim_words($post->post_excerpt,6,' ') ) . '</div>';
}
}
Hi Jamal,
Try this:
add_action( 'after_setup_theme', 'tu_move_wc_price' );
function tu_move_wc_price() {
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 1 );
}
Thanks David and Tom. I used Tom's snippet and it works great. Wonderful stuff !
No problem Jamal and thanks Tom - this and the other link Jamal provided regarding hooks has been extremely handy. In the meantime i have just finished crafting 3 shortcodes that allow me to position excerpt, description and price anywhere on the page. They work great in Tom's new headers - i have full screen featured images in the header with title, price etc......
Tom i expect to see these turn up in the header template tags.....