• Resolved digitos

    (@digitos)


    Hi,
    I don’t understand what hook i have to use to customize the loop of upsell products.
    I would like to add the excerpt.

    Can you help me?

    thank
    Tobia

    • This topic was modified 6 years, 2 months ago by digitos.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter digitos

    (@digitos)

    Ok, I know this file but which hook? I don’t understand.

    Can I use woocommerce_after_shop_loop_item_title only in upsell loop?

    thanks!
    Tobia

    Thread Starter digitos

    (@digitos)

    I solved it!
    I added the description of product (or variation) to the upsell loop with JQuery.

    <?php 
    woocommerce_product_loop_start();
    
    foreach ( $upsells as $upsell ) : 
    
    $post_object = get_post( $upsell->get_id() );
    $post_object->post_content="<p>".strip_tags($upsell->description)."</p>";
    setup_postdata( $GLOBALS['post'] =& $post_object );
    wc_get_template_part( 'content', 'product' ); ?>
    
    <script type="text/javascript">
    jQuery(".post-<?php echo $post_object->ID;?> .fusion-price-rating .price").before("<?php echo $post_object->post_content;?>");
    </script>
    
    <?php 
    endforeach;
    woocommerce_product_loop_end(); ?>
    • This reply was modified 6 years, 2 months ago by digitos.
    • This reply was modified 6 years, 2 months ago by digitos.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hook to customize Upsell loop’ is closed to new replies.