Many times We simple edit the functions.php file of the WordPress theme to add any functionality.
It is the Wrong way Because When We update the theme all functionality added will be lost.
Better way to add functions is through the Plugin developed by WooCommerce team.
Download Plugin: https://github.com/woocommerce/theme-customisations
let me know if you have any Questions.