Ideally,
if:
on a product page the variable is returned for that product,
on a category page the variable is returned for the first product listed,
on a checkout page the variable is returned for the first product in the cart,
else if:
not any of these pages the variable returns null.
Way too complicated for my programming skill level

Thanks for any help!