How to add additional info into Product now?
Closed this issue · 4 comments
Hello. I created new site, and changed Product model to as I read in the blog.
If I want to add some additional field into current Product model - e.g. second (third) price - what should I do? (Maybe some tutorial is existing).
Best regards,
Vladimir.
@sailorsamoor you would use the same CRUD functions as is recommended at present. $product->add_meta_data function.
Using that function will ensure your data goes to the right table, at present any additional product data will go into the wp_postmeta table, but if #108 realises it might go to a new table. Using that function will ensure you do not need to update your extensions or custom code constantly to keep up.
@kloon Note that #108 was not about migrating all existing product/post meta to a new table, or storing product meta in a new table. After all, we have no way to tell which of the meta associated with a product ID are WooCommerce-related, and which are not. Moving all of them to a new table would cause issues to plugins that simply see a WooCommerce product as a custom WP post type.
The suggestion in #108 was to introduce a new meta table and let developers decide whether they want to leverage it in their CRUD classes. A good use of that table would be to store product properties of custom product types -- not meta in general.
Right, sorry for the confusion then. Will have a discussion with the team regarding this and will take it from there.
Well, but if I create the meta data, which will be used only me - I just do it, right? I do not need to use any another plugins for work with my meta data - this is only my functionality.
Can I use the new Product model in future production - can I hope that the interface will be permanent?