Support

Account

Home Forums Front-end Issues Woocommerce featured image

Unread

Woocommerce featured image

  • Hi guys,

    I hope you can help me with this. I need to create an advanced custom field to display featured images on different products. We have one product for mens and womens, so want to be able to dictate which image will be displayed first on each category depending on gender.

    This is the code that worked at the old site which used Jigoshop, not Woocommerce. We have converted it for Woocommerce and seems to be working at the back end, but we cant get to show the images at the front end.

    Hope you can help, thanks.

    /* Featured Images */

    remove_action( ‘jigoshop_before_shop_loop_item_title’, ‘jigoshop_template_loop_product_thumbnail’, 10, 2);
    add_action( ‘jigoshop_before_shop_loop_item_title’, ‘jck_jigoshop_template_loop_product_thumbnail’, 10, 2);

    function jck_jigoshop_template_loop_product_thumbnail( $post, $_product ) {
    if(get_field(‘womens_featured_image’, $post->ID) && get_query_var(‘product_cat’) == “womens”){
    echo wp_get_attachment_image(get_field(‘womens_featured_image’, $post->ID), ‘shop_small’);
    } else {
    echo jigoshop_get_product_thumbnail();
    }
    }

Viewing 1 post (of 1 total)

The topic ‘Woocommerce featured image’ is closed to new replies.