{% macro titleField(product) %} {%- import "_includes/forms" as forms -%} {{ forms.textField({ label: "Title"|t, locale: product.locale, id: 'title', name: 'title', value: product.title, placeholder: 'Enter title'|t, errors: product.getErrors('title'), first: true, autofocus: true, required: true, maxlength: 255 }) }} {% endmacro %} {% macro generalMetaFields(product) %} {%- import "_includes/forms" as forms -%} {{ forms.textField({ label: "Slug"|t, locale: product.locale, id: 'slug', name: 'slug', value: product.slug, placeholder: 'Enter slug'|t, errors: product.getErrors('slug')|merge(product.getErrors('uri')) }) }} {{ forms.dateTimeField({ label: 'Post Date'|t, id: 'postDate', name: 'postDate', value: product.postDate, errors: product.getErrors('postDate') }) }} {{ forms.dateTimeField({ label: 'Expiry Date'|t, id: 'expiryDate', name: 'expiryDate', value: product.expiryDate, errors: product.getErrors('expiryDate') }) }} {% endmacro %} {% macro behavioralMetaFields(product) %} {%- import "_includes/forms" as forms -%} {% if product.type.taxCategories|length > 1 %} {{ forms.selectField({ label: 'Tax Category'|t, name: 'taxCategoryId', value: product.taxCategoryId, required: true, options: product.type.getTaxCategories(true) }) }} {% else %} {{ forms.hidden({ name: "taxCategoryId", value: product.taxCategoryId }) }} {% endif %} {% if product.type.shippingCategories|length > 1 %} {{ forms.selectField({ label: 'Shipping Category'|t, name: 'shippingCategoryId', value: product.shippingCategoryId, required: true, options: product.type.getShippingCategories(true) }) }} {% else %} {{ forms.hidden({ name: "shippingCategoryId", value: product.shippingCategoryId }) }} {% endif %} {{ forms.checkboxField({ id: 'free-shipping', fieldLabel: 'Free Shipping'|t, name: 'freeShipping', checked: product.freeShipping, }) }} {{ forms.checkboxField({ id: 'promotable', fieldLabel: 'Promotable'|t, name: 'promotable', checked: product.promotable, }) }} {% endmacro %} {% macro generalVariantFields(variant) %} {%- import "_includes/forms" as forms -%} {% if variant.product.type.hasVariantTitleField and variant.product.type.hasVariants %} {{ forms.textField({ label: "Title"|t, locale: variant.locale, id: 'title', name: 'title', value: variant.title, placeholder: 'Enter title'|t, errors: variant.getErrors('title'), first: true, required: true, maxlength: 255 }) }} {% endif %} {{ forms.textField({ id: 'sku', label: 'SKU'|t, required: true, name: 'sku', value: variant.sku, placeholder: 'Enter SKU'|t, errors: variant.getErrors('sku') }) }} {{ forms.textField({ id: 'price', label: 'Price'|t, name: 'price', value: (variant.price == '0' ? '0'|number : (variant.price ? variant.price|number ?: '')), placeholder: 'Enter price'|t, unit: craft.commerce.primaryPaymentCurrency.iso, required: true, errors: variant.getErrors('price') }) }} {% set stockInput %}