So, I've been trying to find some more documentation on this, but there doesn't seem to be any. I'm a developer for what it's worth, so won't shy away from writing code as long as I'm pointed to proper hooks or examples.
This being said, I've created custom post type, and have set up a relationship( One2Many ) to WooCommerce's Product post type. When I edit a listing in the backend, I've a form to select a product related to my post type, or add a new product and select it automatically. That form is there by default, it appeared once the relationship was set up.
This being said, in said form for adding new product, I only get to set product title, price, stock and sale status. I can pick which fields show, but only stock and sale status are changeable. What I need to do is to actually add more fields to this form. The one I need the most is product image, or featured image.
Unfortunately at the moment there are no options available (via settings or via APIs) to control what fields are shown in that related posts UI. Public custom fields assigned to the post type are included by default. (The cog will allow you to hide such fields, but on a per user basis, there are no global settings.)
And be careful, because the custom fields you can see (e.g. for price) are actually internal Views custom fields that map onto the WC fields and are not the WC fields themselves, and shouldn't be used.
We already have an internal ticket about providing more control over which fields are included in this UI, and I've added your thread to that ticket, as well as asking for us to raise the priority of the ticket, as it is already quite old. I've also asked to remove those 3 internal Views fields from what is displayed, as it can only introduce confusion.
I'm sorry but there simply isn't a solution for what you want right now. You should create the products in the normal product edit page and then connect them to the relevant post from there.
The topic ‘[Closed] Extending Add Product form for Relationships on backend’ is closed to new replies.