Skip to content
Advertisement

Add, update or remove product custom field in WooCommerce

I use the following lines to save a Value to the database. I have one question regarding this code, when I delete input it still keeps it. The only way to delete that is to put (space) as input.

JavaScript

Please give me any tip that you think, can solve this problem.

Advertisement

Answer

Try instead the following revisited code using WC_Data delete_meta_data() method to remove product meta data (meta key + value):

JavaScript

It should work.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement