I am trying to display the thumbnail from a product that a customer would had in its cart on my website. Here is my code :
function fictive_cart()
{
global $woocommerce;
$items = $woocommerce->cart->get_cart();
$nb_article = $woocommerce->cart->cart_contents_count;
$text = array();
$image_link = array();
echo ('<h3 class="lead alt-font" style="text-align: center;"><span style="font-size: 130%;">Votre panier actuel</span></h3>');
foreach($items as $item => $values)
{
$_product = wc_get_product( $values['data']->get_id());
$image_id [] = (int) $_product->get_image_id();
$text [] = (string) $_product->get_title();
echo do_shortcode('[row col_bg="rgb(255,255,255)" v_align="middle" h_align="center"][col span="3" span__sm="12" bg_color="rgb(255,255,255)"][ux_banner height="250px" bg_color="rgb(255,255,255)" ****bg="<?php echo $image_id[0];?>"****][text_box position_x="50" position_y="100" bg="rgba(0, 0, 0, 0.86)"]'.$text[0].'[/text_box][/ux_banner][/col][col span="1" span__sm="12"][/col][col span="3" span__sm="12"][ux_banner height="250px" bg_color="rgb(255,255,255)" bg="957" hover="zoom" link="https://keatbioadmin-keatbio.pf5.wpserveur.net/categorie-produit/recette/"][/ux_banner][/col][/row]');
}
}
I add
****...****
in the last line of the code where I use the command that I want and where it doesn't work. This is just an example for the case where there is only one product into the cart (I save you the other part of my code). But with this setup, the text is well displayed but there is just my principle color displayed instead of the image of the product:
I also tried to get the link of my image but it was the same problem.