Creating Fields for Certain Products Only

Overview

In this advanced tutorial, we will show you a neat little trick to easily print any field on certain products only. This can be useful if you have certain information you want to quickly put on a lot of your products, but maybe not all of them. 

Getting Started

Starting in the Custom Fields App, create a new field. It can be whatever you'd like and whatever you want to name it. If you don't want it to show up on the admin side when editing other fields, set the field type to Liquid Template. It is crucial that you click Exclude from Display, because we will be printing this inside the code of another field!

Field_1.png

Now you will be brought to the Edit Code screen. Copy the print statement, then edit the default example code until you are just printing what you want the field outputting.

Print_Statement.png

Create a new checkbox Custom Field. This field will be used as an on/off button so-to-speak. Don't exclude this one from display.

no_excldue.png

When you save your new field, once again you will be brought to the Edit Code screen. This time, edit the code to display the previous field if the Checkbox is checked, and nothing if the box is unchecked. This will make it easy to quickly manage that field across many of your products.

Note: If you used a liquid template for your previous field, you will need to print this using an include statement instead.

printing_field_values.png

That's It!

Now if you check the box on any of your active products, you will see the field appear on that product.

finish.png