/* 
Theme Name: Hello Elementor Child
Theme URI: https://github.com/elementor/hello-theme-child/
Description: Hello Elementor Child is a child theme of Hello Elementor, created by Elementor team
Author: Elementor Team
Author URI: https://elementor.com/
Template: hello-elementor
Version: 2.0.0
Text Domain: hello-elementor-child
License: GNU General Public License v3 or later.
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: flexible-header, custom-colors, custom-menu, custom-logo, editor-style, featured-images, rtl-language-support, threaded-comments, translation-ready
*/

/* Add your custom styles here */


add_filter(
    'woocommerce_cart_item_thumbnail',
    function ($thumbnail, $cart_item, $cart_item_key) {

        if (empty($cart_item['data'])) {
            return $thumbnail;
        }

        $product  = $cart_item['data'];
        $image_id = $product->get_image_id();

        if (!$image_id) {
            return $thumbnail;
        }

        return wp_get_attachment_image(
            $image_id,
            'large',
            false,
            [
                'class'   => 'cart-product-image',
                'loading' => 'lazy',
                'alt'     => $product->get_name(),
            ]
        );
    },
    10,
    3
);