True, as long as it is not especially made for a ceremony that they disagree with. Which is why many a tale from the Gay Wedding Cake Saga goes as follows: “I never knew that the owners of my favorite bakery did not agree with gay weddings until I asked them to make a cake for mine.”
Let’s use another example. Say you’re an artist. Customers buy copies of your work. You don’t ask them what their views are, you just sell them a copy. But you also do custom work. A long-time customer, who until now has just bought standard entries from your catalog, asks you to do a pornographic scene, or one which glorifies Nazism, or one featuring a clown (and you hate clowns), or whatever other content there may be that you’d have a reason not to want to take on. Should you be required by law to fulfill their request, regardless of whether you want to do it or not? Should you not be allowed to decide whether to accept a commission, as long as we’re talking about custom-made commissions, which is what wedding cakes usually are?
That’s an entirely different matter from allowing business owners to randomly interrogate customers about their sexuality and refusing to sell them bread, or whatever.