You need to log in to create posts and topics.

Longshot question

Is there any way to feed newly created WooCommerce products into posts within a topic such as "new products"?

Hello @dka

This should be possible but requires a bit of coding-experience and knowledge about the WooCommerce API.

public function createProductTopic($new_status, $old_status, $post) {
    if ($post->post_type == 'WCPOSTTYPENAME' && $new_status == 'publish' && $old_status != 'publish') {
        $forumID = FORUMID;

        $post_title = apply_filters('asgarosforum_filter_automatic_product_title', $post->post_title, $post);
        $post_content = apply_filters('asgarosforum_filter_automatic_product_content', $post->post_content, $post);

        if ($this->content->forum_exists($forumID)) {
        	$this->content->insert_topic($forumID, $post_title, $post_content, $post->post_author);
        }
    }
}

What you have to figure out here is:

  • the post-type name of a product
  • the forum-id in which the products should be included in
  • the logic which creates title and text for the product by using the two filters I added

The function can then get called via the following hook:

add_action('transition_post_status', array($this, 'createProductTopic'), 10, 3);

 

Thanks! Where does the "hook" go? I'm still a bit new to this.

David

@dka The code and its modifications can all get added to the end of your themes functions.php file.