Add custom attribute to product’s HTML to woocommerce cart page

You want to override the file, not edit it directly.

How to Edit Files

Edit files in an upgrade-safe way using overrides. Copy the template into a directory within your theme named /woocommerce keeping the same file structure but removing the /templates/ subdirectory.

Example:
To override the cart.php file…

copy:
wp-content/plugins/woocommerce/templates/cart/cart.php

to wp-content/themes/yourtheme/woocommerce/cart/cart.php

The copied file will now override the WooCommerce default template file. Make your updates in the new file.

Here is more detailed information.

tech