0

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 )

Product Accessores Oprtion

 Add Product accessories option

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.

3
  • what code have you used for this so far? only based on an image will not give you much response
    – 7uc1f3r
    Commented Mar 6, 2020 at 20:50
  • I am serializing the product ids and saving it into the post_meta with key _accessory_ids update_post_meta( $post_id, '_accessory_ids', serialize( $_accessory_ids ) ); Commented Mar 7, 2020 at 10:00
  • With this code it is saving into key in this format. 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;} Commented Mar 7, 2020 at 10:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.