{# @var product \craft\commerce\elements\Product #} {% extends "commerce/_layouts/cp" %} {% set selectedSubnavItem = "products" %} {% set bodyClass = (bodyClass is defined ? bodyClass~' ' : '') ~ "commerceproducts commerceproductsedit" %} {% set crumbs = [ { label: "Products"|t('commerce'), url: url('commerce/products') }, { label: productType.name|t('commerce'), url: url('commerce/products/'~productType.handle) } ] %} {% set fullPageForm = true %} {% set saveShortcutRedirect = continueEditingUrl %} {% import "_includes/forms" as forms %} {% import "commerce/products/_fields" as productFields %} {% block header %} {{ block('pageTitle') }} {{ block('contextMenu') }}
{% if showPreviewBtn or shareUrl is defined %} {% if showPreviewBtn %}
{{ "Live Preview"|t('app') }}
{% endif %} {% if shareUrl is defined %} {{ 'Share'|t('app') }} {% endif %}
{% endif %} {{ block('actionButton') }} {% endblock %} {% block contextMenu %} {% if craft.app.getIsMultiSite() %} {% endif %} {% endblock %} {% block actionButton %}
{% endblock %} {% block content %} {% if product.id %}{% endif %} {% if craft.app.getIsMultiSite() %} {% endif %} {{ redirectInput('commerce/products') }} {{ csrfInput() }}
{{ productFields.titleField(product) }}
{% set tabs = productType.getProductFieldLayout().getTabs() %} {% for tab in tabs %} {% endfor %}
{% if productType.hasVariants %}
= 1 %}class="hidden"{% endif %}>
{% if product.hasErrors('variants') %} {% for error in product.getErrors('variants') %}
{{ error }}
{% endfor %} {% endif %} {{ variantMatrixHtml|raw }}
{% endif %} {% endblock %} {% block details %}
{{ productFields.generalMetaFields(product) }} {{ forms.lightswitchField({ label: "Enabled"|t('commerce'), id: 'enabled', name: 'enabled', on: product.enabled }) }} {% if craft.app.getIsMultiSite() %} {{ forms.lightswitchField({ label: "Enabled for site"|t('commerce'), id: 'enabledForSite', name: 'enabledForSite', on: product.enabledForSite }) }} {% endif %}

{{ productFields.behavioralMetaFields(product) }}
{% if not productType.hasVariants %}
{% namespace 'variants['~(product.defaultVariant.id ?: 'new1')~']' %}
{{ productFields.generalVariantFields(product.defaultVariant) }}
{% if productType.hasDimensions %}
{{ productFields.dimensionVariantFields(product.defaultVariant) }}
{% endif %} {% endnamespace %} {% endif %} {% if product.id %}
{{ "Related Sales"|t('commerce') }}
{% if not sales|length %} Add Sale {% else %} {% endif %}
{% if sales|length %}
{% endif %}
{{ "Date Created"|t('commerce') }}
{{ product.dateCreated|date('short') }} {{ product.dateCreated|time('short') }}
{{ "Date Updated"|t('commerce') }}
{{ product.dateUpdated|date('short') }} {{ product.dateUpdated|time('short') }}
{% endif %} {% hook "cp.commerce.product.edit.details" %}
{% endblock %} {% if not product.slug %} {% js %} window.slugGenerator = new Craft.SlugGenerator('#title', '#slug'); {% endjs %} {% endif %}