I could work on core/api.php : acf_form()
// load fields
$fields = apply_filters('acf/field_group/get_fields', array(), $acf['id']);
to modify the fields keys
There is a hook in acf.php : save_post() :
do_action('acf/update_value', $v, $post_id, $f );
I probably won’t be able to prevent the product_variation meta to be linked the product, but I could ensure the meta value to be linked to the product_variation
field_groups : I suppose it’s the post_id from the acf field group (574)
tried it with no change : all the fields have the same id
and behaviour didn’t change.
<input type="text" id="acf-field-commentaire" class="text" name="fields[field_548c7eddacf04]" value="" placeholder="">
on every variation
Full code for the plugin is :
http://pastebin.com/frdtEn1n
Screenshot of the product_variation tab :
http://i.imgur.com/r38fM0e.png (the 4 fields in bold are ACF)
Right now, I’m using :
acf_form(array(
'post_id' => $variation_id,
'form' => false,
'label_placement' => 'top',
'instruction_placement' => 'label',
));
‘return’ didn’t change the behaviour.
If you can dig up the solution you came with at the time, I will be very interested 🙂
I know ACF is working, since I can use /wp-admin/post.php?post=<product_variation_id>&action=edit&message=1 , edit the ACF fields, save them, it works ok. Opening the product edit form next, I find the product_variation fields updated. But can’t save them on this page.
Another alternative : creating the product_variations on the page but forcing the user to edit them on another page (a product_variation edit page)
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.