Replies: 0
My story
I am a developer myself and I love working with WooCommerce. I think it’s a great plugin with many many possibilities, though very simple to use.
For a client, I have to convert/import an old database of products into WooCommerce. I used a lot of functions in the WooCommerce API for this, so my code was pretty clean and short.
After the client walked through the products and changed some things, they found out an attribute and some variations were incorrect. Now I have to loop through the variations to update them without overwriting their changes.
My problem
I found out that the API is not able to help met update one variation or only an attribute for that variation. So I searched for the code that saves variations when you change it manually in wp-admin. That’s when I found out that a lot of the code in the API is literally a copy of the code used by wp-admin. Also the functions are about 230 lines of code.
My question(s)
Separating functionalities into functions that do only one thing, or in coding terms the single responsibility principle. Very useful in big projects like WooCommerce. It allows for code to be re-used and makes your code much more readable. I found parts of the save_variations() functions, like updating attributes, to be very useful in my case, but I cannot use the WooCommerce solution because the code is not a separate function. Why does it seem like code quality is not managed/guaranteed at all? Are you guys working on this?