Home › Forums › General Issues › acf field hooking up with woocommerce hook › Reply To: acf field hooking up with woocommerce hook
iam able to insert acf field into product-data -> genreal tab
// Add ACF file type field to WooCommerce product general settings
function add_acf_file_field_to_woocommerce_product_options() {
global $product_object; // Get the product object
// Define the field settings
$field_settings = array(
'key' => 'field_my_file_field',
'label' => 'File Field',
'name' => 'my_file_field',
'type' => 'file',
'instructions' => 'Upload a file',
'return_format' => 'url', // Change this to 'array' if you want more information about the file
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'product',
),
),
),
);
// Render the ACF field
acf_render_field_wrap($field_settings);
}
// Hook into WooCommerce product general options
add_action('woocommerce_product_options_general_product_data', 'add_acf_file_field_to_woocommerce_product_options');
but upload file is not saved……. when i update the page uploaded file is gone…..
why my upload file is not saved
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.