Set ACF on order during checkout

Question

I’m trying to populate a field on an order with options set by the user during checkout, on our checkout form.

function populate_custom_field_value( $order_id ) { if ( ! empty($_POST['custom_field_value'] ) ) {
update_field( 'field_xxxxxxxxxxxxx', sanitize_text_field( $_POST['custom_field_value']),$order_id );
}
}


My html select component is being inserted correctly, with the values defined in ACF, but it’s not setting the field on the order.
Can anyone see what I’m missing here?

Solved, thanks 🙂

0
8 months 2020-12-04T07:25:55-05:00 0 Answers 10 views 0