Hello everyone,
thank you in advance for your help.
I’m updating the price of a fixed price meta retrieving the info from an API.
I’m able to get the PPOM attached to the product and update the related info.
I’m having issues on updating the info on the table.
I tried the following code but the PPOM info in the table was deleted:
$prezzo_meta = ppom_get_field_meta_by_dataname($key->post_id,’quanti_pezzi_’);
foreach((array)$prezzo_meta[‘options’] as $key => $value){
$qty_key = array_search($value[‘option’], array_column($flyer_qty,’quantity’));
if($qty_key){
$qty_price = $flyer_qty[$qty_key]->Standard_price;
$prezzo_meta[‘options’][$key][‘price’] = $qty_price;
}
}
$product_meta = apply_filters( ‘ppom_meta_data_saving’, (array) $prezzo_meta, $ppom_meta_id );
$product_meta = ppom_sanitize_array_data( $prezzo_meta );
$product_meta = json_encode( $prezzo_meta );
ppom_admin_update_ppom_meta_only( $ppom_meta_id, $product_meta );
Any suggestions on how to update the ppom correctly?