Home > Docs > WooCommerce PDF Invoices, Packing Slips and Credit Notes Plugin > Displaying Parent Categories Alone in WooCommerce Packing Slips

Displaying Parent Categories Alone in WooCommerce Packing Slips

Last updated on September 5, 2024

Generating packing slips for your WooCommerce store becomes effortless with WebToffee’s WooCommerce PDF Invoices, Packing Slips, and Credit Notes plugin. The plugin allows store owners to display products by category on WooCommerce packing slips. Generally, the packing slips will show the parent category and its sub-categories. At times, store owners may require the packing slips to display only the parent category. This type of customization ensures clarity and avoids unnecessary complexity. Store owners can achieve this with the help of a custom code snippet. Below are the key steps:

  • Step 1 – Enable the Group products by ‘Category’ option.
  • Step 2 – Add the custom code snippet to your WordPress site.

Displaying parent categories in WooCommerce packing slips

Below are the detailed steps for the same:

  1. Navigate to Invoice/Packing > Packing slip > General from the WordPress dashboard.
  2. Under the Product display section, enable the Group products by ‘Category’ option.
Enabling the Group products by ‘Category’ option
Enabling the Group products by ‘Category’ option
  1. Click on Update Settings.
  2. Now, add the custom code snippet given below to your WordPress site. You can add it to your active child theme’s functions.php file or use a third-party plugin for the addition. For more details on adding custom code snippets using a third-party plugin, check out the following article: Adding Custom Codes with a Third-Party Plugin.

Note: The packing slip will highlight only the first parent category if a product has multiple parent categories.

The image below shows WooCommerce packing slips before and after adding the custom code snippet. In the example below, the product has two parent categories (Accessories and Men) and a subcategory (Hoodie). Upon adding the custom code, the packing slip will show the first parent category, “Accessories.”