Programmatically create Marketpress products from code?


I'm currently writing a simplified WP dashboard for my users. As part of it, I need to programmatically create MP products from my plugin code, so I can wire up a simpler product form for my users instead of showing them your form.

Is there a recommended way to programmatically hook into your code to create products?

As an added detail, in order to replace the /wp-admin, I'm running my easier dashboard in a completely different path (/easy-admin), so anything that only loads if is_admin() would not be loading.

As part of that last point, I tried requiring class-mp-products-admin.php in my class constructor (so it would be loaded before init was done), doing a wp_insert_post, and hoping your save_init_product_variations would kick in and make the variations for me, but it looked like that wasn't working either. In that case, I got an error that one of your other classes wasn't found, and decided not to follow that rabbit-hole until after I asked you for advice.

I also tried the REST API, but your products were not exposed by default. So I found this document that showed how to add your product types to the REST api from my code. That worked for GET requests (I could list the products through REST) but I could not figure out how to get a POST to work. I guessed their default controller would not work for your POSTS out of the box, but I haven't used WP REST API yet, so I'm not sure if that was the cause.

Either way, I'm 0 for 2. Any advice to point me in the right direction?