WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Creating Products from Front End (1 post)

  1. timothyky
    Member
    Posted 1 year ago #

    Hi,

    Currently I am trying to create a custom front page CMS for adding products for customers. However I am trying to place the product into a category. I have the following codes:

    $post = array(
    				  'ID'             => $product_id ,
    				  'menu_order'     => null ,
    				  'comment_status' => 'closed' ,
    				  'ping_status'    => 'closed' ,
    				  'pinged'         => null,
    				  'post_author'    => $user->ID,
    				  'post_category'  => array(15),
    				  'post_content'   => "test1" ,
    				  'post_date'      => date('Y-m-d H:i:s') ,
    				  'post_date_gmt'  => date('Y-m-d H:i:s') ,
    				  'post_excerpt'   => null ,
    				  'post_name'      => "test1" ,
    				  'post_parent'    => null,
    				  'post_password'  => null ,
    				  'post_status'    => 'publish' ,
    				  'post_title'     => "test1" ,
    				  'post_type'      => 'product' ,
    				  'tags_input'     => null,
    				  'to_ping'        => null,
    				  'tax_input'      => null
    				);
    				wp_insert_post( $post, $wp_error );

    The category ID is 15. I even tried this:
    wp_set_post_terms(139,array(15),'',true);

    Also has anyone been able to have quick codes for setting variable attributes to product based on the page ID?

    http://wordpress.org/extend/plugins/woocommerce/

    [ One hour, on a Sunday and you're bumping? Please do not bump, that's not permitted here. If it's really urgent then consider hiring someone. ]

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.