Skip to content
Advertisement

Get the count of newly published product (today) in WooCommerce [closed]

I have a WooCommerce site where products are considered as trade/deal. Therefore, when someone take a trade (buy a product), it become out of stock.

How to display the number of products that has been published today (the new ones)?

ex: 4 New Trades (products) Published Today

Advertisement

Answer

The custom function below will return with a SQL query the newly published products count (made in the 24 hours):

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.

Tested and working


Usage example (in any php file):

will display something like:

enter image description here

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement