If you want to define an audience that uses the gender attribute in the rule, you must be sure that your store includes a gender element that a shopper can use to provide gender data. You can add this element by customizing a widget that is deployed in your store.
Gender is included as a property in the user view model which is available to all widgets. You can add gender to a widget by updating the HTML in the widget’s template. For example,
<div class="form-group row"> <div class="controls col-md-12"> <label class="control-label inline" for="CC-userRegistration-gender">Gender</label> <select class="col-md-5 form-control" data-bind="value:gender"> <option value="" disabled selected>Select your gender</option> <option value="male">Male</option> <option value="female">Female</option> </select> </div> </div>
Follow these instructions:
Open the Design tab and click Code.
Scroll down to view the Widget Templates or Stack Templates and select the widget/stack instance you want to edit.
The HTML Template window opens, displaying the lines of HTML code.
Immediately above the menu tabs is the Expand Editor icon which allows you to view full screen mode.
Modify the HTML code to include Gender element:
Click Save to confirm your changes.
Click the Preview button to see how the changes will appear in your web store before going live.