Home Forums Pre-Sale Dynamic product image not showing in emails

Dynamic product image not showing in emails

  • Author
    Posts
  • #113703

    Matt Melton
    Participant

    Trying free version. Like it a lot. I’m currently using a product configurator that generates product images dynamically. The correct configured image thumbnail appears in the cart and at checkout. I’m using the following code with apply_filters. The emails, however, are showing the base product image/configuration (featured image). When I turn off the plugin, the default WC emails show the correct image. Any thoughts on how to accomplish for your plugin? Thanks, Matt

    add_filter( ‘woocommerce_cart_item_name’, ‘configured_product_image_at_checkout’, 9999, 3 );

    function configured_product_image_at_checkout( $name, $cart_item, $cart_item_key ) {
    if ( ! is_checkout() ) return $name;
    $product = $cart_item[‘data’];
    $thumbnail = apply_filters( ‘woocommerce_cart_item_thumbnail’, $product->get_image( array( ‘100’, ’80’ ), array( ‘class’ => ‘alignleft’ ) ), $cart_item, $cart_item_key );
    return $thumbnail . $name;
    }

You must be logged in to see replies to this topic. Click here to login or register