Conditional layout on cart items

Is there a way to render content only if x product is added to the cart? For example, show box in home page if productId = “1” is added to cart.

I believe this would only work within the context of the product page, for that I would create a custom component that uses the context of the orderform and renders according to the validations you need.