Call   0208 3131682   Mon-Fri 9am-6pm
Monthly Archives

May 2015

Woocommerce: How to add a simple cost price field to products

By | PHP, Programming, Woocommerce, Wordpress | 28 Comments

In this post I’ll show you how to add a very simple cost price field to your products in Woocommerce. The aim of this is to show admin users the cost price of a product, so they don’t sell it at a loss.

The code is adapted from a post here by Gerhard Potgieter

We add a field to the interface in the general tab pricing section like so:



We then need to be able to save the new cost price field like so:


Just add these to snippets of code to your theme’s functions.php file and you will have a simple cost price field in your Woocommerce products.



Disclaimer: All content on this site, is use at your own risk (Always backup before changing anything in your software/database/servers etc). Techs change, go out of date etc...
I/we accept no liability if anything you use on this site adversely affects you.