Home › Forums › Front-end Issues › acf_form() – action when repeater row added or updated › Reply To: acf_form() – action when repeater row added or updated
@hube2 Hey, I think I’m missing something, because this isn’t sending the email:
function delegate_form_update($value, $post_id, $field) {
$order = new WC_Order($post_id);
// global email settings
$to = get_option('admin_email');
$headers = array('Content-Type: text/html; charset=UTF-8');
// this will hold the number of rows - old value
$old_rows = intval(get_post_meta($order, 'ticket_alloc', true));
// count the rows submitted
$new_rows = count($_POST['acf']['field_63ca95e88557a']); // field key of repeater
if($old_rows != $new_rows) {
// number of rows has changed
$subject = 'Number of rows has changed';
$body = 'This is the mail body';
wp_mail($to, $subject, $body, $headers);
}
return $value;
}
add_filter('acf/update_field/key=field_63ca95e88557a', 'delegate_form_update', 10, 1);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.