We’ve already seen how to hide products based on IP addresses, hide products belonging to a specific category and even hide all products from the Shop page.
Today I want to publish another version of those, but this time we’ll use a custom field / ACF in our conditional logic, so that we can toggle the product visibility based on its value. Enjoy!
Continue reading WooCommerce: Hide Products Based On Custom Field / ACF Value
Alright, this title may not really help you understand what I mean, so let’s put it in another way. When, as an administrator, you edit an order and are in the Order Items table, you have the chance to edit the item quantity, subtotal and discounted price (see screenshot below).
Now, what if you also want to have the freedom to display and edit another custom field, so that it is saved inside the order once you hit the “Save” button?
This could be useful for custom setups – for example let’s imagine the admin has the necessity to also define the “shipped quantity”, so that they know exactly if a specific order has been entirely fulfilled or requires a second shipment to get completed.
Either way, see the screenshot below, play with the snippet, and see how it goes. Enjoy!
Continue reading WooCommerce: Item Custom Field @ Edit Order Page
The default WooCommerce frontend product search returns results based on whether the search term is present in the product title, SKU, short and long description.
But what if you also want to search inside a custom field i.e. you have a custom field called “_brand” and you also want to search by “_brand”?
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
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 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”
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.
Continue reading WooCommerce: View Product/Order Hidden Custom Fields (“Protected Meta”)
As you know, one of the product bulk edit methods comes with WooCommerce out of the box. It can be found under “WP Dashboard” > “Products” > “Bulk Actions” > “Edit”. For example, you can decrease all prices by 10%, or bulk assign a new product category.
However, if you added a custom product field such as RRP, this won’t show automatically there in the bulk edit form – you’ll therefore need to add it via code. Thankfully, WooCommerce gives us a “hook” we can use to display the input in the bulk edit form. After that, another PHP function will be used to save and store the value.
Easy as pie! Just copy & paste into your functions.php. Enjoy 🙂
Continue reading WooCommerce: Add Custom Field to “Bulk Actions” > “Edit”
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
Advanced Custom Fields plugin is a great way to add custom, advanced fields to the WooCommerce Single Product Page. Many struggle to display such fields on the front-end, so this simple snippet should help you!
Continue reading WooCommerce: Display Advanced Custom Fields @ Single Product
A client asked me to show a given custom field in the loop (i.e. Shop page, Category pages, Tag pages = anywhere woocommerce products are returned). Interestingly enough, she didn’t want to show the product short description (see “show product short description on the homepage only” snippet) but a custom field, so here’s how you do it! Continue reading WooCommerce: Show Product Custom Field in the Category Pages
Checkout page plays a huge role in your eCommerce success. It is one of the most important part of your conversion funnel. This is the page that brings revenue.
It doesn’t matter how many people are visiting your website if no one makes any purchase. Complicated checkout process is one of the main reason of high shopping cart abandonment.
You should always look for ways to make your checkout process as simple as possible. If you are using WooCommerce as your eCommerce solution you can easily change the checkout page design, remove or change the existing checkout fields order.
Continue reading WooCommerce Checkout Fields Customization Guide
This snippet could come really handy for several reasons. When you’ll need to do advanced customization of the checkout and its fields, hopefully you’ll thank me then 🙂
In today’s snippet, we will add a new checkbox and another new “hidden” field – then, if the checkbox is ticked, the field will show, otherwise it will disappear again.
Continue reading WooCommerce: Checkbox to Hide/Show Custom Checkout Field
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
Let’s imagine you want to add a custom checkout field (and not an additional billing or shipping field) on the WooCommerce Checkout page. For example, it might be a customer licence number – this has got nothing to do with billing and nothing to do with shipping.
Ideally, this custom field could show above the Checkout page order notes – right after the shipping form. It will feature a label, an input field, and will be required.
So, here’s how you do it – hope it helps you understand that anything is possible with WooCommerce!
Continue reading WooCommerce: How to Add a Custom Checkout Field
By default, WooCommerce adds the “autocomplete” attribute to almost all checkout fields. For example, “billing_phone” has “autocomplete=tel”, “billing_country” has “autocomplete=country” and so on.
When logged out or if the logged in user has never done a purchase before, the WooCommerce Checkout page fields are possibly autofilled by the browser based on saved data / addresses.
Today, we’ll take a look at how to disable this autofill behavior, so that the customer is forced to enter data inside an empty input, and maybe in this way you can apply your custom validation or pattern, such as a specific phone number format. Enjoy!
Continue reading WooCommerce: Disable Checkout Field Autocomplete
You may be aware that the WooCommerce Checkout page “order review” section reloads/refreshes every time there is a change of address – in this way shipping, taxes and optional fees are properly recalculated and customers are returned with the correct total.
But in case you add custom checkout fields that may cause a difference in pricing, or you want to keep the checkout UX consistent, or you have some other kinds of logic, it may be useful to refresh the order review section after a change on any checkout field. Enjoy!
Continue reading WooCommerce: Refresh Checkout Upon Any Input Field Change
This is a great customization for those WooCommerce store owners who are willing to accept donations, custom amounts, or need anyway that the customer enters a custom price on the product page for paying an invoice or a bill.
This is as simple as creating a simple product with $0 price, and after that using the snippet below to display an input field on the single product page, where customers can enter their custom amount. Enjoy!
Continue reading WooCommerce: Allow Customers To Define the Product Price
When you edit an order as an admin, you’re presented with the usual WooCommerce layout: order details on the left, order action on the right, the list of order items on the bottom left, and – possibly – additional meta boxes added by third party plugins (e.g. the PDF Invoice and Packing List plugin order meta box where you can define the invoice date and number).
On top of that, it’s also possible, of course, to define our own custom meta boxes, so that the administrator and/or shop managers can view (or even enter) additional information.
I’ve used it on a client website to show a custom field, but you can print anything you wish – even documentation for shop managers (how to complete the order for example).
So, here’s how we add a new “section” (meta box) to the single order edit page in the WordPress dashboard, and how we display some content in it. Enjoy!
Continue reading WooCommerce: Add Custom Meta Box @ Order Admin
On top of adding products to cart via URL and redirect to checkout, there is a way to also fill out the Checkout page input fields within the same link.
This could be super handy when you know the billing/shipping details of a registered or guest customer and want to speed up the order process.
It’s important to note that the URL will need to contain personal data e.g. email address, billing address, phone number, and so on; you need to make sure the URL is only shared with the specific customer (in an email, for example, as content is tailored to the subscriber; or only when the WooCommerce customer is logged in if you’re using the URL behind a website button).
Once that’s clear, let’s go ahead, and let’s see how my WooCommerce snippet works. Enjoy!
Continue reading WooCommerce: Populate Checkout Fields From URL
You launched a new feature on your WooCommerce store or added a subscription functionality for your customers but aren’t sure how your customers will take it, if it’ll help them, and wish to review the functionality yourself first?
Or, do you take remote orders over the phone and need a solution that lets you place orders on your WooCommerce store on behalf of your customers?
Well, there’s a solution. Several “Shop As A Customer” plugins are available in the market today for distinct WooCommerce use cases. They help you review your WooCommerce store’s functionalities for optimal performance.
So, in this article, we’ll review the top Shop As A Customer WooCommerce plugins and their main features. But first, let’s see how shopping as a customer can benefit your business.
Continue reading WooCommerce: How to Shop As a Customer