Skip to content

Latest commit

 

History

History
42 lines (23 loc) · 2.04 KB

product-types.md

File metadata and controls

42 lines (23 loc) · 2.04 KB

Product Types

Product Types are a way to distinguish products in your system. They can determine the URL format of a product, and also determine if the products has multiple variants, as well as configure other behaviors of the products.

You can also attach fields, and tab layouts to products and variants at the product type level, like you can with Craft's entry types.

Product Type Entry Screen.

Product Type Options

Name

This is the name of the product type as displayed in the control panel.

Handle

The handle is how you will reference the product type in code. For example, in twig, to get product types with a handle of 'clothes', you would do:

{% set clothes = craft.products.type('clothes').all() %}

Automatic SKU Format

What the unique auto-generated SKUs should look like, when a SKU field is submitted without a value. You can include tags that output properties, such as {product.slug} or {myCustomField}

{Tip} The way you access properties within the SKU format will differ depending on whether or not the product type has variants. If your product type has multiple variants, then the SKU formats default object is the variant, otherwise it’s the product.

Show the Dimensions and Weight fields

Allows you to hide the weight and dimensions fields if they are not necessary for products of this type.

Products of this type have multiple variants

If you enable the product type to have multiple variants, you will see a new tab appear at the top of the screen which allows you to configure the variant field layout.

You also have the option to show the title input field or have it default to use a Title Format.

Products of this type have their own URLs

This works the same way the standard Craft entry sections work.

{Tip}When a site vistor hits the URL of a product, the product variable is automatically available to your templates, just like the entry variable for standard craft entries.