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
- How to get orders that contains a product by date?
- Get ALL post ID’s export list (Only id’s. Php or sql not important )
- How do I apply a custom discount to individual product total prices depending on their categories on the cart and checkout pages of WooCommerce? [closed]
- add new post default view
- Custom Post Type – Category Rewrite – Remove Rewrite from Sitemap
- Cannot get $post object in name_save_pre hook
- In woocommerce cart item we can add custom text but how can i add custom link? [closed]
- How to check a post exist when the permalink has post id in it?
- How to hide html tags on revision comparison pages?
- Updating Woocommerce Settings API when WordPress Settings API saved and vise versa
- custom payment gateway in woocommerce failed to connect to remote api server
- Can’t get woocommerce_get_price_html to work [closed]
- Polylang post_translations key [closed]
- Add filter by custom field to block of posts
- Removing noindex posts from wp_query
- Is there a PHP script to replace post date with updated modified date
- Blog page pagination is not working after using the offset argument
- How to restrict access to image folder depending on whether product is purchased or not?
- Recent Post Added To Menu Shows Ghost Post With No Title
- CPT archive redirects to single post
- Archiving by academic year instead of calendar year
- How to display the link (title) and thumbnail post?
- How to extend WooCommerce API to show bookable product availability rules?
- Underscores Theme Unit Testing – Catching Untitled Posts
- get_the_excerpt() is not working as expected – returns wrong text
- Category Page Template not Showing Posts
- Posts will not display on page-mypage.php
- Sort WP posts by span value
- display a random post thumbnail from a random category
- Insert Content In Between Post Feed
- How do I retrieve then print the currently viewed sub categories?
- WP Query – Posts Per Page not working in combination with category__in
- How to bulk-untag multiple posts?
- Apply a style for 4 blogs and another style for the next 4 blogs in wordpress blog page?
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- Relative redirects for posts, categories, products and product categories
- Ajax post filters not working
- Posts gathered from WPEMatico feeds are being mixed in different languages. Polylang is used for language separation
- Show certain posts in a LIST format that members have been granted access to