Setting Up Custom Item Fields
Set up custom item fields to appear in the PDP, Checkout, and My Account. This requires setting up the custom item field in NetSuite and overriding the correct template to render the information in your web store.
To set up a custom item field in NetSuite:
-
In NetSuite, create the custom item field. See Creating Custom Item Fields for details.
Note:The custom item field information rendered to your web store is read-only.
For a custom item field to render in your Commerce website, note the following:
-
Enter a Label and ID for your custom item. If you do not specify an ID, NetSuite will create one for you. Use these when adding field sets and customizing templates.
-
Set the Subtype (Applies To subtab) to either Both or Sale.
-
-
In NetSuite, go to Commerce > Websites > Website List and click edit next to your site.
-
In the Web Site record, click Actions > Rebuild Search Index and wait for the index to build.
-
On the Field Sets tab, perform the following as applicable:
-
If adding the field to the PDP, locate the Details field set name and add the custom field ID to the Fields Included in Field Set column.
-
If adding the field to Checkout or the Purchase History page of My Account, add the field ID to the Order field set name and add the custom field ID to the Fields Included in Field Set column.
Note:The order field set is the default for the Review Order page, but you can change this by editing the
fieldKeys.itemsFieldsAdvancedNameproperty in the SuiteCommerce Configuration Record. See Backend Subtab for details. -
To display the custom item field in the PDP or in Checkout:
-
As part of your theme, update the appropriate template:
-
product_details_full.tpl– exposes the field as read-only information to the PDP. -
transaction_line_views_cell_navigable.tpl– exposes the field as read-only information to the Review Your Order page and in the Order Summary information displayed throughout Checkout.
See Develop Themes for details on creating themes.
Note:If you implementing a SuiteCommerce Advanced site using the Kilimanjaro release or earlier, you must override the appropriate template. See Develop Your SCA Customization for details.
-
-
Add the following code to any HTML tag within the template that does not have the
data-viewattribute:{{model.item.custitem_my_custom_field_id}}In this example,
custitem_my_custom_field_idis the ID of your custom item fieldNote:If the custom field record’s Type is set to Multiple Select, the values render on your site separated by commas.
-
Save your code and test on a local server or deploy to NetSuite and activate as required.
To display the custom item field in My Account:
-
As part of your theme, update the
transaction_line_views_cell_actionable.tpltemplate.See Develop Themes for details on creating themes.
Note:If you implementing a SuiteCommerce Advanced site using the Kilimanjaro release or earlier, you must override the appropriate template. See Develop Your SCA Customization for details.
-
Add the following code to the template wherever you want the field to appear:
{{model.item.custitem_my_custom_field_id}}In this example,
custitem_my_custom_field_idis the ID of your custom item field -
Save your code and test on a local server or deploy to NetSuite and activate as required.