Go to WooCommerce->Settings->Tax tab. Enter the tax class in the Additional tax classes textarea and click on the save changes button.
Then the tax class will appear under the Tax tab. Set the tax rule for store location.
Now go to product details page and click on the Sample Product tab. Enable tax class and select a tax class for sample from dropdown.
When add to cart the sample product then the tax class will be applied to the sample product automatically.