WooCommerce: Search Products By Custom Field (Backend)

In WooCommerce, there are two kinds of search: the customer one (frontend) and the admin one (backend). We’ve already covered how to let customers search into custom field values on top of the default product title and description, so this time we’ll talk about the backend search.

Let’s say, as a WooCommerce store admin, that you’ve added a product custom field (e.g. “gtin“), and you want to make sure the backend search also returns products where “gtin” is equal to the search term. The snippet below will help you do that. Enjoy!

Continue reading WooCommerce: Search Products By Custom Field (Backend)

WooCommerce: Display Product ACF Value @ Shop Page

We already talked about displaying an ACF field on the single product page. This time around, we’ll do the exact same but for the product loop pages (shop, category, tag, etc.). ACF (Advanced Custom Fields) is an awesome plugin to create and manage custom fields, so this is definitely a tutorial that will help many WooCommerce developers.

Please note that if ACF is not active, the snippet will break the site. There is a way to make it trigger only when ACF plugin is active, just so you know. Anyway, let’s see how we can display the value of a product ACF inside the loop. Enjoy!

Continue reading WooCommerce: Display Product ACF Value @ Shop Page

WooCommerce: Search By Custom Field (Frontend)

The default WooCommerce frontend product search returns results based on whether the search term is present in the product title, short and long description. Also, you can optionally search products by SKU.

But what if you also want to search for a custom field value e.g. you have a custom field called “_brand” and you want to get the products where “_brand” is equal to “apple“?

Now, I’m not sure I’ve explained this in plain English, so let’s take a look at a practical example. Enjoy!

Continue reading WooCommerce: Search By Custom Field (Frontend)

WooCommerce: How to Add Custom Fields to Variations

When selling products on your WooCommerce store – you want to provide as much product information as possible to your customers. This is especially because, unlike a physical shop or a brick and mortar store – your online customers cannot physically touch or experience the products before buying them. 

Hence, providing additional information and keeping customers informed about the multiple facets of your products is essential. And an effective way to enhance customer experience is by adding custom fields for product variations. 

Product variations are product attributes – including the product’s size, color, pattern, texture, and style. On the other hand, WooCommerce custom fields allow you to add additional data for individual products – to display on a single product page. 

Custom field variations let you add data unique to an individual product – which can include anything from the product’s ISBN, additional product specifications, radio buttons, and checkboxes. Thus, custom fields for product variations could either mean: 

  • Fields to display additional product variation’s information, or 
  • Fields to accept customer input to customize the product variation through dropdowns or radio buttons. 

So, in this article, we share simple yet efficient ways to add custom fields to product variations. But, first – let’s see how adding fields for product variations help your WooCommerce store. 

Continue reading WooCommerce: How to Add Custom Fields to Variations

WooCommerce: Add Custom Field to “Quick Edit”

WooCommerce product custom fields are possibly the most used customization from what I’ve seen over the years on clients’ websites.

Adding custom fields to the product backend is pretty straight forward (including the input fields to be used for editing their values), however there are two additional areas where you need to do more work in order to allow for custom field editing: the “Quick Edit” and the “Bulk Edit” sections (WordPress Dashboard > Products).

We already saw how to allow a new custom field to appear in the Bulk Edit section, so this time we’ll talk about the Quick Edit window. So, how do we add a custom field in there (WordPress Dashboard > Products > Hover on a given product > Quick Edit)?

Well, here’s a fully working snippet for you. Enjoy!

Continue reading WooCommerce: Add Custom Field to “Quick Edit”

WooCommerce: View Product/Order Hidden Custom Fields (“Protected Meta”)

I was working on a WooCommerce project recently and I didn’t want to waste time searching through all the hidden product post meta.

Post meta are basically product custom fields that are added via the update_post_meta() WordPress function by WooCommerce itself, a custom plugin, a snippet, a theme. For example, “total_sales” is a default WooCommerce product custom field that updates every time the product is purchased. You can “get” total sales with the get_post_meta() WordPress function.

In the same way, there are dozens of default and third party product custom fields that are stored inside the WooCommerce product meta. If the product custom field “meta key” starts with an underscore (“_”), however, this won’t be visible in the “Custom Fields” section of the edit product page screen. Which is a bummer.

So, today, I’ll show you a quick trick so you can always know what the values for product meta keys are without having to mess with print_r() or error_log() in your PHP functions. In the image below, you see the final outcome.

Please note this also shows order hidden meta.

Enjoy!

Continue reading WooCommerce: View Product/Order Hidden Custom Fields (“Protected Meta”)

WooCommerce: Add Product Table Columns @ Admin

The default WooCommerce Dashboard Products page (/wp-admin/edit.php?post_type=product page) shows the list of products in a table. Default fields are: Image, SKU, Stock, Price, Categories, Tags, Featured and Date.

Sometimes, these columns are not enough and you need more. For example, you might want to quickly take a look at a product custom field, such as “visibility” (whether the product is hidden or not).

So, here’s the snippet for that. Of course, you can adapt it to show your own custom field, an ACF field or whatever product-related information you require.

Continue reading WooCommerce: Add Product Table Columns @ Admin

WooCommerce: Multi-Vendor / Marketplace Solutions

Building the next Amazon is everyone’s dream.

Allowing sellers to use your online platform to reach wider audiences without holding stock, investing in shipping and warehousing and – let’s be honest – with a few dollars budget… is actually possible in WooCommerce.

The WooCommerce Multi-Vendor/Marketplace scenarios are many – not a surprise. And sometimes, a plugin is all you need to build an Etsy-alike website. Not bad for a small investment – you can focus on the marketing while the WooCommerce plugin does the rest.

However, building a full website, no matter its project specifications, is never easy. Many WooCommerce and ecommerce entrepreneurs underestimate how much work, caution, attention, patience and money are needed to develop an online marketplace.

Nothing is free – if something looks doable with a $79 plugin you also need to consider the cost of time, outsourcing, marketing and third parties (such as picking a reliable hosting).

Anyway, today we’ll take a look at some of the best plugins for turning a WooCommerce website into a multi-vendor marketplace, as well as a simple PHP snippet that might just be enough for you. Enjoy!

Continue reading WooCommerce: Multi-Vendor / Marketplace Solutions

WooCommerce: Add Custom Field to Product Variations

Adding and displaying custom fields on WooCommerce products is quite simple. For example, you can add a “RRP/MSRP” field to a product, or maybe use ACF and display its value on the single product page.

Easy, yes. Unfortunately, the above only applies to “simple” products without variations (or the parent product if it’s a variable product). So the question is: how do we add, save and display a custom field for each single variation?

Continue reading WooCommerce: Add Custom Field to Product Variations

WooCommerce: Add Custom Product Fields (e.g. RRP) Without a Plugin

The manufacturer’s suggested retail price (MSRP), or the recommended retail price (RRP), is the price at which the manufacturer recommends that the retailer sells the product at. You might have seen this in an ad, on a magazine, on a price tag: “RRP: $50. Our price: $39!”.

WooCommerce entrepreneurs can take advantage of this “marketing trick” too. The only problem is: how do we show this “extra field” on the single product page AND in the product edit page, so that the website owner can add this easily?

Continue reading WooCommerce: Add Custom Product Fields (e.g. RRP) Without a Plugin