v1.61
Cart guards, active product media, app blocks in groups
Let your app hold a product back from the cart until the shopper has finished personalising it, and draw your preview over the right photo.
New for app developers
- Cart guards.
window.PlatformDTC.cart.addGuard(productId, fn), orctx.addCartGuard(fn)in a theme app block, runs before every add to cart, Buy it now and express wallet button for that product. Return{ ok: false, message }and nothing is added and checkout does not open. Theplatformdtc:cart:blockedevent tells you, and the storefront shows your message unless you handle it. See Cart guards. - Active product media. Theme app blocks in a product section with a gallery get
ctx.activeMedia({ index, id, type }) andctx.onMediaChange(cb), so aproduct_mediapreview can show over its own slide only. See Product media blocks. - App blocks inside groups. A Group block accepts app blocks, so merchants can put your block inside a titled panel (a "Personalized" box) from the theme editor.
Fixed for merchants
- Product photos meet the header on phones. With Media edge to edge on phones on, the product section no longer leaves an empty band above the photo.
- "Made with PlatformDTC" no longer covers your page. The badge used to float over the bottom-right corner, over product text and buy buttons on phones. It now sits in its own row at the very bottom of the page, after your footer.