php - Woocommerce remove order item meta

556

I have a plugin that adds custom meta to Woocommerce Order Items.

In certain circumstances I'd like to be able to remove them (or rename them).

Along withwc_add_order_item_meta() andwc_update_order_item_meta(), though, I wasn't able to find a function to delete them.

I guess I could use update with anull value, but I'm not sure if that is functionally equivalent to it.

349

Answer

Solution:

wc_delete_order_item_meta( $item_id, $meta_key ); 

or even this

delete_post_meta( $order_item_id, 'your_meta_key');

People are also looking for solutions to the problem: php - Prevent Back Login After Logout by hitting the Back button on Browser in L5?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.