I've tried so many different ways of handling this, but every way results in the same exact result. All I'm trying to do is programatically generate woo products.
As the most basic of implementations doesn't even seem to be working, I am at my wits end for resolving this.
I have tried this :
$new_product_post_id = wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => 'Test content', 'post_author' => 1, 'post_name' => 'test-post', 'post_title' => 'test product title', 'post_status' => 'publish', 'post_type' => 'product', 'tax_input' => array( 'product_cat' => array( 150 ) ), ) );
On the dashboard, in the products menu I can SEE the product and all of the data has been properly saved. Title, Content, Permalink, Category...everything saves correctly.
The issue is that the post NEVER displays on the front end, in the shop, in the sidebar, or anywhere.
If I click 'View' from within the post edit screen it takes me right to the single product listing.
only once I manually click 'Update' on the post does the post even appear inside of any of the queries.
Please....someone point me in the right direction before I rip my hair out. I've asked in both woo commerce support forums, but they're pretty unresponsive and I don't plan on ever getting a response.