Constant defined in header.php not visible in functions.php
I have defined constant in header.php file:
define( 'HOME_URL', esc_url( home_url() ) );
and used in functions.php file:
function woocommerce_header_add_to_cart_fragment( $fragments ) {
ob_start(); ?
div class=cart-customlocation
img class=cart-img align-top src=?php echo HOME_URL . '/wp-content/uploads/icons/header/cart.png'; ?
div id=cart-count class=d-inline-block?php echo WC()-cart-cart_contents_count; ?/div
div class=cart-description d-inline-block ml-4
div id=cart-titleCart/div
div id=cart-total?php echo WC()-cart-get_cart_total(); ?/div
/div
/div
?php
$fragments['div.cart-customlocation'] = ob_get_clean();
return $fragments;
ob_start();
?
div class=mini-cart
?php woocommerce_mini_cart(); ?
/div
?php
$fragments['div.mini-cart'] = ob_get_clean();
return $fragments;
}
add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );
and getting notice: bWarning/b: Use of undefined constant HOME_URL - assumed 'HOME_URL'...