/*
Theme Name: Lucent
Theme URI: https://lucent.qodeinteractive.com
Description: Lighting Shop Theme
Author: Mikado Themes
Author URI: https://qodeinteractive.com
Text Domain: lucent
Tags: one-column, two-columns, three-columns, four-columns, left-sidebar, right-sidebar, custom-menu, featured-images, flexible-header, post-formats, sticky-post, threaded-comments, translation-ready
Version: 1.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.

*/

add_filter('woocommerce_get_item_data', 'display_reference_in_cart', 99, 99);

function display_reference_in_cart($item_data, $cart_item) {
    if (isset($cart_item['data'])) {
        $product = $cart_item['data'];
					echo "got here";

        $reference = $product->get_attribute('reference'); 
        if (!empty($reference)) {
            $item_data[] = array(
                'name' => 'Référence',
                'value' => $reference
            );
        }
    }
    return $item_data;
}
