Home Forums Add-ons Repeater Field selection fields dynamic options add/remove


selection fields dynamic options add/remove

  • im using mysql to populate a seletion fild (on a repeater group) like this :

    function acf_some_field( $field ) {
     // global $wpdb;
    global $wpdb;
    $result = $wpdb->get_results("SELECT roupa,qtd FROM bruno_closet_stock ");
    foreach($result as $row) {
        //Change this to whatever data you are using.
        $data_from_database = $ro;
        $field['choices'] = array();
        //Loop through whatever data you are using, and assign a key/value
        foreach($data_from_database as $field_key => $field_value) {
            $field['choices'][$field_key] = $field_value;
        return $field;
    add_filter('acf/load_field/key=field_56d8760d3a9e1', 'acf_some_field');

    its all good but i need to subtract (on selection ) the item from the list and update the database so it works like an inventory stock for quantity… (imagine i have like 3 items and i want to only use this 3 and subtract them as i select them from the list and add them if i cancel the item)

Viewing 1 post (of 1 total)

The topic ‘selection fields dynamic options add/remove’ is closed to new replies.