WooCommerce Product Cost Price module allows you to save the cost you pay for the products you sell in your WooCommerce store, as well additional information (shipping, etc.), for reporting purposes at a later date. When you come to off-set the price you are paying versus the price you sell for, this tool will come in handy! Save WooCommerce product purchase costs data for admin reports!
Default Price Fields
These are default product cost fields – choose which one (or none) do you need.
Custom Price Fields
Add custom fields, which will be included in product cost calculation. You can choose field’s name, type (percent or fixed) and default value.
Info fields are not used in product cost calculation, but you can save additional info (like purchase date) here.
Admin Orders List Custom Columns
If you want to add Profit column to admin’s products list page, you can enable it in this section.
Admin Edit Product
After you set all options, visit selected product’s edit page. There you will find Booster: Product Cost Price metabox. After filling metabox fields, press Update, and Booster will automatically calculate products cost and potential profit for you.
If you need to retrieve saved cost in PHP – Booster uses
_wcj_purchase_price meta key, e.g.:
echo get_post_meta( $product_id, '_wcj_purchase_price', true );
This will return main product cost (purchase price). If you want to get final cost (i.e. with extra expenses, custom price fields etc.), you need to use
wc_get_product_purchase_price( $product_id = 0 ) function:
echo wc_get_product_purchase_price( $product_id );
wcj_get_product_purchase_price filter is applied to final function’s output:
apply_filters( 'wcj_get_product_purchase_price', $purchase_price, $product_id );