php - WooCommerce: Remove all attributes from product when click on duplicate or draft button

one text

I am creating new product by clicking on duplicate button on exciting product, while creating duplicate product all attributes are also duplicate.

I want to remove all attributes while creating duplicate product, also i want to remove all attributes when i edit exciting product and click on draft button.

I found these two similar code, 1st from GitHub and 2nd this code from another question.

I am looking for a query or some code snippet that will help me.

for now, I have no idea how to do this.

I just want to remove all attributes, while creating duplicate product and editing product.

Source