attribute_setting

The attribute_setting object represents a single custom attribute field, such as a custom field collected when a customer registers. The available fields come from shop.attribute_settings, which you loop over to render each field.

{% for attribute_setting in shop.attribute_settings %}
	{{ attribute_setting.title }}
{% endfor %}
			

The attribute_setting object has the following attributes:

attribute_setting.id

Returns the unique ID of the custom attribute field. This is commonly used to build the field's name and id attributes.

<input name="customer[attributes][{{ attribute_setting.id }}]">
			

attribute_setting.title

Returns the title (label) of the custom attribute field.

attribute_setting.input_type

Returns the input type of the field, for example dropdown or date. Use it to decide which form control to render.

{% if attribute_setting.input_type == "dropdown" %}
	<select>...</select>
{% endif %}
			

attribute_setting.is_required

Returns true if the field is required, otherwise false.

<input {% if attribute_setting.is_required %}required{% endif %}>
			

attribute_setting.options

Returns an array of the available options for a dropdown field. Each option has a value.

{% for option in attribute_setting.options %}
	<option value="{{ option.value }}">{{ option.value }}</option>
{% endfor %}
			

attribute_setting.value

Returns the value saved for the custom attribute field.

icon-accounticon-add-newicon-add-storeicon-appicon-appleicon-archiveicon-arrowdownicon-ascicon-bookicon-cancelicon-cart-addonicon-checkouticon-cherryicon-collectionicon-comfirmicon-confirmicon-couponicon-creditsicon-currencyicon-dashboardicon-discounticon-disintegrateicon-domainicon-dscicon-duplicateicon-editicon-emailicon-exclamation-triangleicon-exporticon-eyeicon-eye-slashicon-fullscreenicon-fullscreen-closeicon-generalicon-gifticon-gridicon-hddicon-helpicon-importicon-infoicon-integrationicon-invoiceicon-likeicon-listicon-locationicon-logouticon-new-tabicon-not-secureicon-optionicon-ordericon-outline-arrowdownicon-pageicon-paymenticon-plusicon-posicon-pricingicon-printericon-producticon-product-sumicon-product-sum-xicon-redirecticon-reporticon-reseticon-searchicon-secureicon-settingicon-shippingicon-staricon-storeicon-switch-storeicon-tagicon-taxesicon-templateicon-themeicon-tickicon-trashicon-unarchiveicon-uploadicon-user-tagicon-usersicon-weighticon-wholesale