I have a custom HTML form I am saving the product data using WordPress-Woocommerce functions.
I am able to save all the product details but getting issue in saving Product Accessories ( please check the attached screenshot )
I have saved the product accessories in a serialized array format. Which might be not correct.
Is there any other way of saving the product accessories. Any Woocommerce Function/filter/hook?
Thanks in advance.
update_post_meta( $post_id, '_accessory_ids', serialize( $_accessory_ids ) );
s:71:"a:5:{i:0;s:2:"70";i:1;s:2:"58";i:2;s:2:"46";i:3;s:2:"27";i:4;s:2:"24";}";
But It should be in this format.a:2:{i:0;i:20;i:1;i:28;}