I am working on wordpress with woocommerce and using WCK plugin for custom fields. I am creating products programatically.
I need to save custom fields data as array in database progrmatically. But it is not saving correctly and not showing the custom field values in backend for products. I am using this code.
$data= array(
'alternative-product-names' => $alternative_pname,
'manufacturers-part-number' => $manufature_park_number,
'currently-packaged'=> $currently_packaged,
'other-package-options' => $other_pkg_opt,
'inner-pack-qty' => $inner_pack_qty,
'inner-pack-dimensions' => $inner_pck_dimension,
'packaging-picture'=>''
);
update_post_meta( $post_id, 'productextrainfo1234', $data );
I need to save data in this format:
a:1:{i:0;a:15:{s:25:"alternative-product-names";s:4:"fgfg";s:25:"manufacturers-part-number";s:4:"gffg";s:18:"currently-packaged";s:4:"fgfg";s:21:"other-package-options";s:4:"fgfg";s:14:"inner-pack-qty";s:4:"fggf";s:21:"inner-pack-dimensions";s:17:"packaging-picture";s:3:"561";}}