Woocommerce: protect a product with password

By default the “standard protect with password funciont” seems not work.

HERE THE SOLUTION:

Update content-single-product.php with this condition

  1. if ( !post_password_required() ) {
        // Display your product
    } else {
        echo get_the_password_form();
    }