Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hi here is the solution how to add a product on woocommerce site via front end
    You don’t need the pro version…

    ADD PRODUCT

    line 22: CHANGE ‘post_type’ => ‘post’ TO ‘post_type’ => ‘product’

    line 115: AFTER &show_count=0 ADD &taxonomy=product_cat
    line 117: AFTER &show_count=0 ADD &taxonomy=product_cat

    line 408: CHANGE $post_category = $_POST[‘category’] TO $post_category = $_POST[‘category’][0];

    line 443: AFTER if ( $post_id ) {

    ADD THIS CODE

    //set category id;
    $category_ids = array((int)$post_category);
    wp_set_post_terms( $post_id, $category_ids, ‘product_cat’);

    line 454: REPLACE add_post_meta( $post_id, $key, $val, true );

    WITH
    //set product price
    add_post_meta( $post_id, ‘_price’, $val, true );

    line 473: BEFORE //plugin API to extend the functionality

    ADD THIS CODE

    //do product visible
    update_post_meta( $post_id, ‘_visibility’, ‘visible’ );

    DASHBOARD

    line 25: CHANGE ‘post_type’ => ‘post’ TO ‘post_type’ => ‘product’

Viewing 1 replies (of 1 total)