Menu Close

Get Support From ShopWired Close

All systems operational

Subscribe To Updates
Prefer To Live Chat? Chat directly with ShopWired support Available 9.30am to 5.30pm Monday to Friday (extended hours coming soon) Quickest response time
Send A Message
Response within 24 hours

Menu Close

Menu

Custom fields

The custom fields extension is an advanced and powerful tool that can be used to add additional data to categories, brands, products and orders.

Different types of custom fields are available (text fields, data lists, product lists, dates and times), and can be used for a number of different purposes.

At the most basic level, custom fields can be used to show additional data on your website such as a specification table (as shown in the example below).

Functionality as shown in the example above can be achieved by creating a custom field for each specification type, like 'Colour' or 'Screen Size Diagonal' and then entering the appropriate data for each product.

At a more advanced level, custom fields can be used to change the functionality of your website (for example to swap an 'add to basket' button to an 'enquire now' button on product pages if a custom field is selected).

Configuring custom fields
Adding data for custom fields (categories, products & brands)
Using custom fields on your website
Adding data for custom fields (orders)
Using order custom fields on your ShopWired account
Use case examples


Configuring custom fields

Once you've activated the extension, select 'settings' from the left menu and then 'custom fields'.

At the top of the page you can use the box to create a new custom field.

In the Item Type field select which type of field you are creating, either one for products, categories, brands or orders.

In the Name field you need to enter the variable that you'd like to use when referencing the data in the field on your website files. You should only use letters and the _ character here (no spaces).

The Sort Order field enables you to organise the order in which the custom fields are displayed when adding data to them on pages in the admin system. You can leave this field blank if the order is not important to you.

In the Label field you can enter the label of the field, as it will display to you when adding/editing the product, category, brand or order.

In the Type field you should select what type of data the field will contain. In our example above (the specification table) you would use 'Text Box'.

Depending on the Type selected, you may be able to configure the Allowed Values for the field. For example if you select 'List' then you'll be able to enter the available values (separating each with a comma).


Text Box A text string
Toggle Either a TRUE or FALSE option
Choice A list of available values for you to choose one of, using radio buttons.
List A list of available values for you to choose one of, using a drop down list.
Date Picker Pick a date
Date & Time Picker Pick a date & time
Value List Enter a list of individual values
Product List Pick from a list of products

The below is an example of how a custom field might look if configured correctly for a 'Screen Size' attribute.


Adding data for custom fields (categories, products & brands)

When adding/editing a product, category or brand, scroll to the 'custom fields' section.

The fields for the products that you have created will be displayed in this section.

Enter your data into the fields and click the save button.

If you've created a product list custom field then the drop down will display all of the products loaded onto your account for you to select from.


Using custom fields on your website

Data attached to a product, category or brand through the custom fields system is available through the corresponding Twig object. (Either the product, category or brand object).

Our example below is for custom field data attached to a product, so uses the product object, if you're using custom fields for brands or categories, substitute the format of the variable to use the corresponding object.

The format required is product.custom_fields.X where X is the name given to the custom field, e.g. product.custom_fields.screen_size.

Where you have created a Toggle custom field, the variable will return TRUE or FALSE depending on whether the custom field is ticked or not.


Value Lists

Where you have created a Value List custom field, the variable will return an array.

{% for value in product.custom_fields.X %}
	{{ value }}
{% endfor %}

It's also possible to reference a a specific element of the array, e.g. product.custom_fields.X[0], 0 is the first item in the array.


Product Lists

Where you have used the Product List type, this will also return an array which can then be used to return details about the selected product(s). For example,

{% set product_id  = product.custom_fields.X[0] %}
{% set alternative_product = product(product_id) %}
{{ alternative_product.title }}

In the example above we've referenced just the first selected product, in the example below we're iterating through all the selected products.

{% for value in product.custom_fields.X %}
    {% set product_id  = value %}
    {% set alternative_product = product(product_id) %}
    {{ alternative_product.title }}
{% endfor %}

Dates

Where you have used the Date Picker or Date & Time Picker type, you can modify the output using Twig's Date Filter.


Adding data for custom fields (orders)

Order custom fields are created in the same way that they are for products, categories and brands (described above).

When creating or editing an order, you can then select the data for the custom field(s).

When adding data to an order you are creating, you can edit the data once the order has been created from the custom fields section. Custom field data attached to orders can be changed at any time.

Custom field order data is exported within the order CSV export.


Using order custom fields on your ShopWired account

Update (30th Aug)

Currently order custom fields cannot be used as filters on orders or for searching, but this is functionality that we will be launching very soon.

Custom fields for orders are available on the Order Object (using Twig coding).

This means that you can use order custom field data in the following places/functionality:

• Order confirmation emails (when custom data is added to an order at the time the order is created through the admin system)
• Order status emails
• Order PDF
• Order XML feed
• The order pages (within customer accounts)


Required Format

The format required is order.custom_fields.X where X is the name given to the custom field, e.g. order.custom_fields.sage_customer_id.

Where you have created a Toggle custom field, the variable will return TRUE or FALSE depending on whether the custom field is ticked or not.


Value Lists

Where you have created a Value List custom field, the variable will return an array.

{% for value in order.custom_fields.X %}
	{{ value }}
{% endfor %}

It's also possible to reference a a specific element of the array, e.g. orer.custom_fields.X[0], 0 is the first item in the array.


Product Lists

Where you have used the Product List type, this will also return an array which can then be used to return details about the selected product(s). For example,

{% set product_id  = order.custom_fields.X[0] %}
{% set alternative_product = product(product_id) %}
{{ alternative_product.title }}

In the example above we've referenced just the first selected product, in the example below we're iterating through all the selected products.

{% for value in order.custom_fields.X %}
    {% set product_id  = value %}
    {% set alternative_product = product(product_id) %}
    {{ alternative_product.title }}
{% endfor %}

Use case examples

The most common, and most obvious, use of custom fields is to display additional information on your website. The information can be as simple as one line of text, or more structured data as shown at the top of the page.

Moving to an intermediate level, custom fields can enable things to be 'done' or displayed in a certain way when enabled. For example, a custom field checkbox (of the 'toggle' type) allows you to select (or not select) and the custom field variable on your website will then return true or false. In twig, you can detect this true or false state of the custom field and action code accordingly. For example, a 'This product is POA' tick box could be used to hide a product's price and add to basket button and instead display an 'Enquire about this product' button.

At a more advanced coding level, toggle custom fields can be used to render completely different product, category or brand page templates/layouts.

Using custom field product lists, on category pages you could output a list of 'favourite products' for each category, or on product pages show different products for customers to purchase with the product they're viewing (e.g. essential accessories, recommended products).

Custom field product lists can be displayed in various places, so you could for example display a section of 'we recommend you purchase these products' in a popup, displayed when the main product is added to the basket.


Order custom fields

Using order custom fields you can store and output additional information attached to an order (such as a Sage Accounts Customer ID).

You can use toggle choices to change the design or layout of customer facing information like order confirmation emails and invoice PDFs.

Data in custom fields is available on order status emails too. Using this system, you can attach as much information about an order as you like and then send this through to the customer through the order status email system.