A Better ‘pre_get_posts’ Search for WooCommerce

WPSSO + WooCommerce

I recently wrote a plugin to provide missing GTIN, GTIN-8, GTIN-12 (UPC), GTIN-13 (EAN), GTIN-14, ISBN, MPN, Depth, and Volume values for WooCommerce Products and Variations. As part of that plugin, I extended the WordPress search feature to include metadata from WooCommerce products (and their variations). The standard way to extend the WordPress search feature is to hook the “pre_get_posts” action and modify the WP_Query to include additional posts / products in search results. There are some serious drawbacks to doing this – with or without WooCommerce – but especially with WooCommerce.

Continue reading


GTIN, UPC, EAN, ISBN, MPN for WooCommerce

WPSSO + WooCommerce

There are several ways to create additional product information in WooCommerce – the most common is by creating Product Attributes, either as an Attribute taxonomy term or individually for each product, and then using those Product Attributes for variations. This is great for selectable variation attributes like Color, Size, etc., but does not work well for unique / singular information like GTIN, UPC, EAN, ISBN, and MPN (Manufacturer Part Number). What is required instead is a different way to manage this unique / singular information on the product editing page, which is then shown on the WooCommerce purchase page under the “Additional information” tab.

Continue reading