Home Forums ACF PRO Adding fields to WooCommerce Attributes (not attribute terms) Reply To: Adding fields to WooCommerce Attributes (not attribute terms)

  • Actually, there is a solution, but I didn’t have enough time to realize it through acf, maybe this will help someone to realize this task.
    And so: on the page of creating/editing taxonomy (attribute), custom form, which has hooks:
    woocommerce_after_edit_attribute_fields – for the attribute edit page.
    woocommerce_after_add_attribute_fields – for the add attribute page.

    I can add a custom input \select \anything through this hook, and then, on the admin_init hook (for example), check $_POST and if my input is there (if my input is there, there will be other inputs from the form), save this value in the database table. You can save it anywhere, but it is more correct to save it in a custom table, and create a link, for example, by the key (slug) of the attribute, for example pa_finish. And as a result, when processing a product or a taxonomy term, we can take the slug of the taxonomy (attribute) and use it in the custom table in the database to get the value that we attached to the form of creating/editing the attribute.
    Thus, I can save primitive data, such as select to specify the type of display attribute (image \ color \ text \ select) and based on this, display the necessary html for a particular attribute.

    John Huebner – I’ve seen a lot of your posts, and I think you can do it).