black friday sale

Custom Fields
Re-Envisioned
Support General Field value not saving

  • Creator
    Topic
  • #22461
    Resolved calpaq
    Participant

    Hi Support,
    Can you please help me with my problem using metabox plugin with woocommerce product post type, I followed the article present on the site to create a field. Actually the scenario is I am creating a field with Woocommerce CPT product to add floor plan field so our client want to upload the related floor plant to the property (product) so I have created a following code

    
    function samo_register_meta_boxes( $meta_boxes ) {
        $meta_boxes[] = array(
            "id" => "property-floor-plan",
            "title" => "Floor Plan",
            "context" => "side",
            "post_types" => array("product"),
            "fields" => array(
                array(
                    "type"  => "image_advanced",
                    "force_delete" => true,
                    "max_file_uploads" => 1,
                ),
            )
        );
    
    return $meta_boxes;
    }
    add_filter( "rwmb_meta_boxes", "samo_register_meta_boxes" );
    

    This is showing field in the product editor and let me select the image or upload but after that when I update the product in the refreshed screen to edit the product I do not see that image again, it is not saving it. How can I solve it or am I missing something.

    Thanks & Regards,
    Calpaq

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #22464
    Long Nguyen
    Moderator

    Hi,

    The field ID is required to save the field value, please add the setting id to the field and save it again.

    "fields" => array(
        array(
            "id" => "my_image_advanced"
            "type"  => "image_advanced",
            "force_delete" => true,
            "max_file_uploads" => 1,
        ),
    )
    #22498
    calpaq
    Participant

    Hi Long
    Thanks for your help it worked.
    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.