How to alert customers about free shipping threshold?

This worked, but is there a way to make it so that the message doesn’t appear when the cart is empty?