I’m trying to figure out the best way to approach this issue.
I am building a site that sells products that require the customer to be 18+ years old. I do not want to force identification upload on sign-up, but would like to have a section in “My Account” that says “Hey, you haven’t uploaded your identification yet!” and displays an image upload section.
This field would hopefully also display when a user tries to make a purchase, as a requirement (if the user has not already uploaded an image).
The image would be stored in the User Profile section for the admin to view
I have started messing with Advanced Custom fields but feel I might be in over my head. Any help is appreciated.
What I have so far, pulled from other help topics is :
add_action( 'woocommerce_save_account_details', 'acf_form_head', 20 );
function my_woocommerce_edit_account_form() {
?>
<fieldset style="margin: 20px 0">
<legend>Identification Upload</legend>
<?php
acf_form( array(
'post_id' => 'user_' . get_current_user_id(),
'form' => false,
'fields' => array(
'field_5af31e4caa87d',
),
'return' => false,
) );
?>
</fieldset>
<?php
}
add_action( 'woocommerce_edit_account_form', 'my_woocommerce_edit_account_form' );
This displays the field in account details but also displays a “Warning: array_merge(): Argument #1 is not an array” message and the upload function does not work.
Any help appreciated. I know I’m an amateur but really trying here.