Support

Account

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