The hidden danger of dot (Or why should your metafield not contain . in the name)

A dot (.) – it is harmless. What harm can it do, it looks pretty innocent.

And yet it can break your Catalog UI.

Psyduck, from Pokemon Go
A dot can look pretty harmless and innocent, just like a Psyduck. Frankly, its eyes are also two dots.

Catalog UI relies on the Shell UI from CMS to render properties and such. Shell UI, in its hands, needs to know about the metadata of the properties. When you have dot in the metafield names, the MetaDataPropertyMapper will create an Property with that name on site start up. And then when you open All properties mode, Shell UI will request your content type models, and CMS Core will happily return those properties.

Continue reading “The hidden danger of dot (Or why should your metafield not contain . in the name)”

How to check if a coupon was successfully applied

When a customer add a coupon to his/her cart, it’s nice and best practice to show to him/her if the coupon has been applied successfully, or if it was an invalid/not applicable code.

Coupon has been applied successfully
Coupon has been applied successfully

How can you do that?

In old promotion system

When old promotion system run, each successfully applied promotion will be presented by an instance of Discount, which has a property named DiscountCode – this is the coupon used for the promotion (it can of course be null if the promotion requires no coupon).

Continue reading “How to check if a coupon was successfully applied”