Reputation: 389
I have a code that change the product image in the cart and checkout depending on a value in the cart_item. It worked for a year but have suddenly stopped working in the checkout page but still working in the cart.
The hook is woocommerce_cart_item_thumbnail
and I need help to figure out why it has stoped working in the checkout page only.
This is the code:
``
add_filter( 'woocommerce_cart_item_thumbnail', 'getCartItemThumbnail', 111, 2 );
function getCartItemThumbnail( $img, $cart_item ) {
if( isset($cart_item['farg']) ) {
$product = $cart_item['data'];
$galleri = $product->get_gallery_image_ids();
foreach($galleri as $bild){
$bild_alt = get_post_meta($bild, '_wp_attachment_image_alt', TRUE);
if( mb_strtolower($bild_alt) == mb_strtolower($cart_item['farg']) ){
$img = wp_get_attachment_image( $bild, 'woocommerce_thumbnail' );
}
}
}
return $img;
}
``
I have tried to deactivate all other custom code running on this site. I have tried other hooks. I have search to see if there have been any changes to this code in WooCommerce.
Upvotes: 0
Views: 13