Home › Forums › Add-ons › Repeater Field › Adding new row of repeater in PHP › Reply To: Adding new row of repeater in PHP
This is my test code I am using at the moment
add_action('save_post_product', 'rl_acf_test', 999);
function rl_acf_test($post_id) {
// Avoid infinite loop when using update_field()
remove_action('save_post_product', __FUNCTION__);
// Check if stock is managed
$product = wc_get_product($post_id);
if (!$product ) {
return;
}
// Update the repeater
$rows = [[
'event_date' => "30062025",
'shipping_date' => "30062025",
'return_send_date' => "30062025",
'return_arrival_date' => "30062025",
]];
//$status = update_field($repeater_name, $new_rows, $post_id);
//$status = update_field($acfFieldObject['key'], $rows, $post_id);
$status = update_field('rental_info', $rows, $post_id);
error_log("Status is: " . var_export($status,true));
$product->save();
}
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.