Cost of Goods showing as 0.00 cost
-
I have a weird issue I can’t seem to figure out. I am trying to add the cost of goods to my products so I can better analyze my actual net sales but I seem to be having a weird issue with this.
https://imgur.com/a/gxCJE78
You can see my cost of the product is $25 and I sold it for said cost but at the bottom when completing the order says my total cost is 0.00 so it’s still showing up in my analytics as a $25 profit when it should be net 0.
-
Hi @kylestilkey,
Thanks for reaching out! I had a look at the screenshot you linked, but I wasn’t able to clearly see all the details of the order line items and the Cost of Goods meta box, so I’d love to clarify a bit more.
Could you please share:
- A full screenshot of the Edit Product page showing the “Cost of Goods” field with the saved value.
- A full screenshot of the Edit Order screen showing the product line item and where the cost is showing as
0.00. - The version of WooCommerce and the WooCommerce Cost of Goods extension you’re currently running.
A couple of quick things to double-check in the meantime:
- Make sure the Cost of Goods field is saved at the product level (not just variation, if you’re selling variable products).
- Confirm that the order was created after you set the cost value, older orders may not retroactively calculate costs.
- Try creating a fresh test order to see if the cost is recorded correctly.
With those extra details, we’ll be able to dig in and see whether it’s a configuration issue, a version conflict, or something else.
What do you mean? The screenshot shows the lines right in it, COST 25.00 PRICE 25.00 PAID 25.00 COST (After total at the bottom) 0.00. Not sure what you could possibly mean you can’t see it?
https://imgur.com/a/dtAkWZr
I am using the default one built in under Advanced Features. The issue is, I have the value set to 0.00 as I don’t want to create 1000 different products for 1 item when I can just manually adjust it. When I change the values to their cost (product itself and on the sale) it shows correctly up top but the bottom final cost doesn’t update, I have to recalculate it and the final cost will update. It seems that there is just an issue with it recalculating the final cost.
-
This reply was modified 2 months, 1 week ago by
KyleStilkey.
-
This reply was modified 2 months, 1 week ago by
KyleStilkey.
I guess besides that weird issue, does the built in function not support the actual cost of goods? It still functions as if it’s revenue when it shouldn’t. Again this is just the built in Cost of Goods in Woocommerce under Advance > Features.
Sorry for the updated post again, so I figured it out, I updated everything to have a value and so forth. There is definitely an issue going on with the default cost of goods. When I add the product I can see the cost of goods say is $20, with the product being $50. It won’t calculate it into the final total at the bottom of the order unless I hit the recalculate button then it shows the final total cost for each item. When I click on update order the cost of goods for the final total goes back to $0.00. I tested this on a simple product too so and it’s happening to Simple and Variable products.
I am using version 10.2.2 of Woocommerce. I’ll keep testing stuff but as of now it just seems to be a final calculation issue where it’s reverting the total cost of goods on the order back to $0.00.After some further testing, there must be something wrong on my end, I have a few other websites I run and none of them are experiencing this. I tested creating a brand new product on both sites, set goods cost and product prices. Create a new order and selected the new product. I see the cost of goods and click create. One one site, it reverts the final total of cost to $0.00. On the other site, it keeps it’s cost of goods I had set. I disabled all plugins but Woocommerce and the issue still shows.
I’m wondering if I might even have a database issue going on?-
This reply was modified 2 months, 1 week ago by
KyleStilkey.
Hi @kylestilkey,
Thanks for the detailed troubleshooting! It sounds like you’ve done some excellent detective work here. You’re absolutely right that this appears to be a calculation issue where the cost shows correctly in the line items but reverts to $0.00 in the final total when you update the order.
The built-in cost of goods feature in WooCommerce (under Advanced → Features) is primarily for basic cost tracking. For comprehensive profit/loss analytics and reporting that treats cost of goods properly in your revenue calculations, you’d typically need a dedicated extension like Cost of Goods which provides more robust reporting features. Could you confirm if that’s the same plugin you’re using?
Regarding your issue, since you’ve confirmed this works correctly on your other sites but not this one, and the problem persists even with all plugins disabled except WooCommerce, this definitely points to something site-specific. Possibly a database issue as you suspected, or a theme conflict.
- Try clearing transients and object cache (if enabled), and consider running a WooCommerce database update from WooCommerce → Status → Tools.
- Even with plugins disabled, leftover data or hooks from previously active plugins or themes might interfere. Try switching to a default theme like Storefront and retest the behavior.
- Enable WP_DEBUG and check WooCommerce → Status → Log to see if any errors that reference cost calculations or order meta updates.
I hope that helps. Let us know how it goes.
I’ve done all that so far, but not tested changing the theme, but it’s the same between the two sites. I’ll do a test and see if maybe some reason the themes busted or causing some issues and will update my findings.
Enabling Debug these are the errors I get.
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the
ddwc-multiposdomain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at theinitaction or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /srv/www/wordpress/wp-includes/functions.php on line 6121Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the
woocommerce-jetpackdomain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at theinitaction or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /srv/www/wordpress/wp-includes/functions.php on line 6121Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the
woocommercedomain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at theinitaction or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /srv/www/wordpress/wp-includes/functions.php on line 6121Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the
mfn-optsdomain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at theinitaction or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /srv/www/wordpress/wp-includes/functions.php on line 6121Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /srv/www/wordpress/wp-content/plugins/vpn-guard/includes/class-vpn-admin.php on line 419
-
This reply was modified 2 months, 1 week ago by
KyleStilkey.
Hi @kylestilkey,
Thanks for the update and for continuing to dig into this.
The debug notices you shared are also telling, especially the ones about translation domains being loaded too early. While they don’t directly affect cost calculations, they do suggest that some code (possibly from your theme or previously active plugins) is executing prematurely, which could disrupt WooCommerce’s save routines.
Try performing the theme conflict check first. Even if both sites use the same theme, subtle differences in customization or child theme structure could be affecting the outcome. Do the same for the rest of the checks. If you’re comfortable, inspect the
wp_postmetatable for affected orders and look for entries like_wc_cog_order_total_cost. Check whether the value is being saved or overwritten.After testing the theme switch, let me know what you find. That might be the missing piece.
I swapped themes and it still does it, even with just WooCommerce off.
I looked into the wp_postmeta table and I have no entries for a _wc_cog_order_total_cost or any sort of total cost on either site.
Did a bit more digging, I see it is creating it as _cogs_total_value. I can see it controls the product, both are working. I will say I notice one thing between both of my sites.
When I am editing the site an order I am having issues with I notice the URL says this.
wp-admin/post.php?post=5508&action=edit
Now on the site it’s working
wp-admin/admin.php?page=wc-orders&action=edit&id=164
I am wonder if this is causing the issue? One is going through post.php where the working site is going through admin.php and an action. I mean the site I am working with that has issues is about 4 years old and could be editing the data/table differently?
That’s what I have noticed.-
This reply was modified 2 months, 1 week ago by
KyleStilkey.
-
This reply was modified 2 months, 1 week ago by
KyleStilkey.
That was it, I found the issue of this mystery. So it looks like Goods and Services does not work with WordPress posts storage (legacy) but will work under High-performance order storage (recommended). The reason I didn’t know there was a difference was due to one plugin I use, the MultiPOS doesn’t support the High Performance Order Storage and forces legacy on even if disabled, I didn’t know this and had to sync over everything to the new High Performance mode and once I did so, resyncing the order and updating it now keeps the Goods of Cost.
I have tested syncing over to High Performance with Multi POS off, GOS saves on the order and stays. Tried the compatibility mode and turning on Multi POS, GOS fails to save in the final total. I disabled Multi POS but left legacy on and testing high with compatibility, both failed to keep the GOS cost in the final total. Turning back on High Performance mode, GOS came back and stayed with the final total.
I am wondering if this is a bug or something that can be fixed on WooCommerce’s end. I didn’t see any sort of post_meta being created for the order for a _cogs_total_value or something along the lines of that and I am wonder that since there is nothing being created that there is no data to read which then defaults to just 0.00.
Anyways I at least figured that end out, now it’s to wait back to hear from you if this can be fixed with WooCommerce, but I will also reach out to Multi POS and see if they can make the system compatible with the newer High Performance.My last question for this to, does this not get shown in the analytics data as it shows still as a full revenue and doesn’t change the net sale at all. Say I sold something for $500, cost me $100. Should show a Net Sale of $400, but it shows as a full $500 made in profit. Is that how the built in one is supposed to work?
-
This reply was modified 2 months, 1 week ago by
KyleStilkey.
Hi there!
Thank you for providing more information about the issue. I was able to replicate it on my end as well — the Cost of Goods appears as 0 when the legacy system is enabled.
It’s a good idea to contact the Multi POS plugin support team and suggest that they make their plugin compatible with HPOS.
Additionally, I’d recommend creating a bug report here so our developers can review it and help address the issue with the legacy system enabled.
As for the Analytics data, the built-in WooCommerce Analytics reports calculate Net Sales based on total sales minus refunds and discounts — they don’t factor in product costs unless a plugin specifically integrates that data. So, in your example, the Analytics report would show the full $500 as revenue, not $400 profit.
Hi, I’m the developer responsible of the COGS feature at Automattic. Saving COGS values for orders is currently implemented only for HPOS, so of course you will see the cost value for all orders as 0 if you have HPOS disabled.
That said: I’ve implemented support for order COGS values with HPOS disabled in https://github.com/woocommerce/woocommerce/pull/61307, it will land in WooCommerce 10.4. Sorry for the trouble.
Hey it’s no problem at all, I’m glad to see it’s going to be fixed, but also pointed me to see I wasn’t on HPOS too which honestly I should be. I’ve reached out to MultiPOS but we will see. Thanks again for taking to time to fix this.
Hi @kylestilkey,
Thanks so much for the thorough follow-up, and great job tracking down the root cause! It’s really helpful to have that level of detail, and I’m glad to hear things are working as expected now with HPOS enabled.
I’ll go ahead and mark this topic as resolved, but if anything else comes up, don’t hesitate to reach out. We’re always here to help.
If you’ve found our support helpful, we’d be incredibly grateful if you could leave a quick review:
https://wordpress.org/support/plugin/woocommerce/reviews/Thanks again, and happy selling!
You must be logged in to reply to this topic.