• Hello,

    I wanted to ask if there is any way to reset the view count for products.
    When creating products I duplicate an existing similar product and change the paramets that are different.
    When doing so, the view count is copied as well. Because of that, I have prodcuts with very high view count, that actually have only been viewed once or twice by me, to check if everything looks right.
    Is there any way to wipe the view count of a specific product or of all products and have it start over?

Viewing 1 replies (of 1 total)
  • Hi @rauser

    I came here to ask the same, and felt that the developer is not around. Below you can find how I performed said task, it is not pretty, though.

    Place this code in functions.php file. Once you are logged in as admin, all the stats for product count will be flushed.

    Caution: note that after you flushed the view counts, you need to comment the add action row, otherwise -obviously- every time you view a page as admin, the stats would be flushed.

    Hope it helps

    //add_action("admin_head", "remove_product_view_count");
    function remove_product_view_count(){
       $ids = wc_get_products( array( 'return' => 'ids', 'limit' => -1 ) );
       foreach($ids as $id){
          update_post_meta( $id, "zwcmvp_product_view_count", (string) 0 );
       }
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Reset View Count for all products’ is closed to new replies.