I searched for this but couldn't find anything I already saw this post Programmatically adding images to media library

the problem is you cant get the new media url right away and put it as meta data of your product

How can I programmatically add WooCommerce product photo from external URL

I have from that user submit product from front-end

add_action('transition_post_status', 'new_product_add', 10, 3);
function new_product_add($new_status, $old_status, $post) {
        $old_status != 'publish' 
        && $new_status == 'pending' 
        && !empty($post->ID) 
        && in_array( $post->post_type, 
            array( 'product') 
        ) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.