Support

Account

Home Forums Backend Issues (wp-admin) Add ACF to existing Woocommerce metabox Reply To: Add ACF to existing Woocommerce metabox

  • No, both traditional ACF field group and ACF group added into Woocommerce do not contain the same field(s). I’ve found that you need to manually save the ACF fields within woocommerce_process_product_meta. Feels a little dirty, but it works.

        add_action( 'woocommerce_product_options_general_product_data', function() {
            acf_form([
                'post_id' => get_the_ID(),
                'field_groups' => [233],
                'form' => false,
            ]); 
        });
    
        add_action( 'woocommerce_process_product_meta', function($post_id) {
            if (!empty($_POST['acf'])) {
                foreach($_POST['acf'] as $key => $value) {
                    update_field($key, $value, $post_id);
                }
            }
        });