php - Update_post_meta function missing a process -


i writing simple plugin updates meta values woocommerce products. did research , worked on it, got 90% of wanted, simple process missing though. let me explain issue simple example.

product variations

  --------------------------------------  variations:      500 gms | 1 kg | 2 kg   --------------------------------------  regular price:   100     | 200  | 400  --------------------------------------  sale price :     90      | 180  | 360    

now using function update_post_meta update prices plugin. works filled values, let if don't want use variation , make both values (sale price , regular price) blank , same process,database values updated blank in display shows 0 value.

where if make blank value product edit page wordpress, works expected.

can please tell me missing here ?

i think figured out. saying missing , it.

$id = get_the_id(); wc_product_variable::sync( $id ); 

variables sync process needed in order make work.

i hope helps.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -