Home > Docs > WooCommerce Picklists Plugin > Adding Product Meta Column to WooCommerce Picklists

Adding Product Meta Column to WooCommerce Picklists

Last updated on December 9, 2024

The product meta column within a picklist is a valuable repository of enriched product information. It assists the store packers by providing clear and organized information about the products they need to pack. WebToffee’s WooCommerce Picklists plugin helps to add a new product meta column to a picklist and sort it based on the added column. Sorting the picklist becomes easier when we use the product meta column. Below are the brief steps for adding a new product meta column to a picklist and sorting it.

Step 1: Add a new column using the custom code.

Step 2: Add product meta to the new column.

Step 3: Sort the picklist.

Step 1: Add a new column to picklists

Below are the detailed steps for the same:

  • Add the custom code snippet below to create a new product meta column.
    • You can add the following code to the active child themes functions.php file or use a third-party code snippet plugin. To learn more about how to add a custom code snippet using a third-party plugin, check out the following article: Add Codes Using Third-Party Plugins.
⚠️

In the code snippet, replace the column name ‘weight’ with the preferred column name.

The following image shows a sample picklist with a new product meta column ’WEIGHT‘ added to it.

New column added - WooCommerce picklist
New column added – WooCommerce picklist

Step 2: Add product meta to the newly added column

Use the code snippet below to add product meta to the newly added column.

  • You can add the following code snippet to the active child themes functions.php file or use a third-party plugin. To learn more about how to add a custom code snippet using a third-party plugin, check out the following article: Add Codes Using Third-Party Plugins.
⚠️

In the code snippet, replace the meta key ‘_weight’ with the preferred meta key.

The following image shows a sample WooCommerce picklist with a new product meta (’weight’) column.

WooCommerce picklist with a new column
WooCommerce picklist with a newly added column

Step 3: Sort the picklist

The next step is to sort the picklist based on the newly added product meta column. To do so, add the following custom code snippet to the active child theme’s functions.php file. You can also use a third-party plugin to add custom code snippets. To learn more, check out the following article: Add Codes Using Third-Party Plugins.

⚠️

The above code snippet sorts the picklist in ascending order. To sort picklists in descending order, replace SORT_ASC with SORT_DESC.

The following image shows a sample picklist sorted in ascending order with respect to the newly added column.

Picklist sorted in ascending order
Picklist sorted in ascending order