Customizing the Free Gift Selection rendering
The Free Gift Selection rendering includes a rendering variant in the form of a Scriban template. The Free Gift Selection rendering has its own default rendering variant root and default rendering variant (/sitecore/Content/<tenant>/<site>/Presentation/Rendering Variants/Free Gift Selection), which uses a Scriban template for generating the markup and an AJAX call to the CD to trigger the Add-to-cart event when the Claim gifts button is clicked. Free gifts are added to the cart lines using the API and the IsFreeGift property is set to true.
While you can modify the Scriban template, it is best to create a new custom rendering variant in this case so that the customization does not get overridden during software upgrades. You can also change the labels for the rendering.
The following code shows the Scriban template for the Free Gift Selection rendering defined within the default rendering variant. The list of sellable items from which a shopper can select their free gifts is passed to the Scriban template using the embedded item o_model.
Free Gift Selection rendering model
Free Gift Selection rendering model
In the Scriban template for the Free Gift Selection, you access the properties and objects contained in the FreeGiftSelectionRenderingModel model through the embedded item o_model as shown in the following figure.

Free Gift Selection call sequence
Free Gift Selection call sequence
The following sequence diagram shows a high-level view of the calls made when the shopper selects and claims their free gifts. Only one call is used to retrieve the latest cart details so that the Free Gift selection rendering is automatically updated whenever the shopper makes changes.
