[Resolved] Move price on product category

Home Forums Support Move price on product category

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #343304
    Jamal

    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
    price

    Thanks

    Agressively support the kind of work you want to see. Buy it. Talk about it. Review it.

    GeneratePress 1.3.48
    GP Premium 1.3.1
    #343306
    Jamal

    Just to clarify more i will be most happy if i can make it look like on the single product

    View post on imgur.com

    Agressively support the kind of work you want to see. Buy it. Talk about it. Review it.

    #343379
    David
    Staff
    Customer Support

    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>';
    	}
    }
    
    #343512
    Tom
    Lead Developer
    Lead Developer

    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 );
    }
    #343636
    Jamal

    Thanks David and Tom. I used Tom’s snippet and it works great. Wonderful stuff !

    Agressively support the kind of work you want to see. Buy it. Talk about it. Review it.

    #343642
    David
    Staff
    Customer Support

    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…..

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.