Technically speaking, Woocommerce products are just another WordPress post object with a customized post type (which is product in this case). If you take a look at the create_product function inside class-wc-api-products.php, you’ll see this line:
// Attempts to create the new product
$id = wp_insert_post( $new_product, true );
So the API ends up using wp_insert_post eventually. I guess you can do both but it’s obviously using what WooCommerce API provides to create a WooCommerce product is a better way to go.
Related Posts:
- How to add an admin notice upon post save/update
- Passing current cookies in wp_remote_get to get Draft Post Preview
- Listen to Post action
- Manipulate post category after time
- Create custom page in WooCommerce
- which action to hook to in order to perform post-publish action
- Cannot access current post’s ID in custom plugin
- Set number of article per number of page
- How to change post status from publish to draft using hook in wordpress?
- prevent showing posts of an specific category in admin posts section
- Using radio button meta data from a custom meta box
- How to Use PHP Code In-Page?
- How to store an extra (surrogate) ID when creating a post with wp_insert_post?
- Global $post not working in OOP function WordPress
- Define a wordpress constant through plugin functions?
- Display featured products by category
- How to get post bulk edit action trigger and get edited post ids?
- Insert woocommerce products programmatically with featured image and gallery
- Problem with adding programmatically woocommerce product post into category
- updating a post doesn’t trigger a function
- Hide a specific category in admin All Posts page (WordPress)
- Prevent Delete Attachment by URL or When Submit
- What hook do you use to update a post?
- Skip in WordPress Post ID’s, can this cause issues?
- Updating post data on save (save_post vs wp_insert_post_data)
- How do I change the core post search algorithm? Where is it found/constructed?
- Redirect to another page using contact form 7? [closed]
- Show posts count for Categories and Tags in wp_nav_menu
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- Filter Hook for post table (not columns)
- why str_replace targeting pages instead just targeting post?
- Is it possible to automatically publish a post once a woo-commerce product is published?
- Restore woocommerce orders
- Get author posts count after excluding a category
- Stop post submission without losing data?
- Cant’ Grab WordPress Built-in Posts Through Loop
- How can my plugin display a populated new post window
- search content of pages and list in wp-admin
- Finding a post’s slug
- Insert specific information to a posts of a predefined category
- Open a wordpress single post in a lightbox without the header and footer
- Target only single product page
- Get category slug of the Parent category of a Product
- How to fetch courses in all languages in WordPress?
- WordPress: Develop multiple posts with different data
- How to distinguish pages created by woocommerce?
- Disaply products from category
- Show code only on WooCommerce Pages
- How do I change the post title’s link on the posts page?
- Update user meta when post published no working
- Fixing the WP Post Object for Custom Route
- Export Posts with specific custom fields by sql
- Custom plugin to get related posts by category
- Woocommerce – custom post type of checkout page
- Hide the contents for specific post
- Wp_query WooCommerce products
- Error 404 blog/page/2/
- How to get only post=’product’
- Onclick open posts displayed in slider in a popup [closed]
- How do I save JS classes being applied to the WP dashboard via custom plugin?
- I am having a problem with fetching product data in the Gutenberg block editor
- Add custom Attachment Display Setting for images
- Rewriting post slug before post save
- Replacing all attachment links in post with media file link
- get all products of one category
- Remove Posts Quick Edit link for specific user role? WP 3.3
- exclude particular posts in archive.php
- How to display post tags
- Debugging WP routing
- WordPress menu that shows all posts in a certain category like w3schools
- Filter Posts by Excluding Categories
- Custom Post Templates
- How to limit displayed posts on wordpress
- post-page: reference to parent page?
- Dashboard :10 Last draft page and 10 last pending review page (metabox)
- Move first half of posts to one parent page, second half to the other page
- Check if checkbox is marked on publish/update post
- Can I search posts and pages for css classes?
- Need to remove duplication content on home page in wordpress theme
- Disable auto-save and post revisions from inside a theme or plugin
- Refresh problem post is duplicated when page is submitted after page reload
- Migrate posts from category and sub-category via SQL
- How to get post with slug and exclude categories
- How can I set a maximum allowed post size and number of posts submitted?
- Adding post date will not insert new post
- Categories Listing and Highlighting current category item
- WP_Query get posts in custom database table [duplicate]
- How to save template data into wp_post table (post_content column)
- Sticky Post Doesn’t always work
- woocommerce wc_get_product is not fetching all the product of particular category
- Add post id as body class in wordpress admin dashboard [duplicate]
- How to add content to the menu
- Multiple Custom Post Type loop logic
- WP_Query retrieve custom posts but not the post showing
- How to handle dates, trying to calculate time since a post
- How to Post to Specific Pages?
- How to have more post in a page than in your home page
- Exclude a ‘portfolio’ custom category?
- Allow User Can See His Post on his dashboard
- How to delete posts with incorrect status