[Support request] Custom Hero Image woocommerce

Home Forums Support [Support request] Custom Hero Image woocommerce

Home Forums Support Custom Hero Image woocommerce

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1146093
    angela

    I started with the Mellow from your site library.

    I have woocommerce and the page hero wants to pull the featured image from woocommerce which is like the first product image. Obviously a hero and a first product image are completely different.

    So is there a way I can add a URL to a custom field and have that shown as the hero image?

    #1146367
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You can definitely use a custom field.

    For example:

    add_filter( 'generate_page_hero_background_image_url', function( $url, $options ) {
        if ( is_singular( 'product' ) ) {
            $custom_field = get_post_meta( get_the_ID(), 'your_custom_field', true );
    
            if ( $custom_field ) {
                $url = $custom_field;
            }
        }
    
        return $url;
    }, 10, 2 );

    Let me know if you need more info 🙂

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