Skip to content
InfinityKnow

InfinityKnow

Infinity Knowledge (IK) : Technology, Articles, Topics, Facts or many More.

  • Home
  • Education
    • yttags
    • Make Money
    • Jobs
    • Programming
      • Technology
      • Web Design
      • WEB HOSTING
      • Interview
  • Entertainment
    • pakainfo
    • Sports
    • Tips and Tricks
      • Law
      • Photography
      • Travel
  • Health
    • Insurance
    • Lifestyle
      • Clothing
      • Fashion
      • Food
  • News
    • Insurance
      • Auto Car Insurance
      • Business Insurance
    • Donate
    • California
  • News
    • Political
  • Home Improvement
  • Trading
    • Marketing
    • Top Tranding
    • Business
    • Real Estate
  • Full Form
  • Contact Us
  • Vuejs Countdown Timer Minutes Seconds Example
    Vuejs Countdown Timer Minutes Seconds Example Technology
  • Angular Toggle Class using ng class Technology
  • atm full form – atm Kya Hai, Meaning and Abbreviation – What is the full form of atm? full form
  • Vue Drag and Drop Sortable Example – Vuejs Draggable
    Vue Drag and Drop Sortable Example – Vuejs Draggable Technology
  • happy birthday sister Status
  • Angular interview questions for freshers Technology
  • Chat Applications
    Top 5 Team Chat Applications in 2021 Technology
  • Orthopedic
    What are the Reasons for Taking Help of Orthopedic Specialist ? Health

Woocommerce Product publish, update and delete hooks

Posted on August 1, 2020 By admin No Comments on Woocommerce Product publish, update and delete hooks

Today, We want to share with you Woocommerce Product publish, update and delete hooks.In this post we will show you woocommerce shipping calculator hook, hear for woocommerce save_post product we will give you demo and example for implement.In this post, we will learn about WooCommerce hook on product updated or added with an example.

Woocommerce Product publish, update and delete hooks

There are the Following The simple About Woocommerce Product publish, update and delete hooks Full Information With Example and source code.

As I will cover this Post with live Working example to develop woocommerce order notes hook, so the woocommerce_add_to_cart for this example is following below.

Updated method for WooCommerce 3.x

[php]
add_action( ‘woocommerce_update_product’, ‘plugin_name_sync_on_product_save’, 10, 1 );
function plugin_name_sync_on_product_save( $product_id ) {
$get_all_product = wc_get_product( $product_id );
// return json data
}
[/php]

READ :  Angular Form Validation ngMessages

[php]
add_action( ‘added_post_meta’, ‘plugin_name_sync_on_product_save’, 10, 4 );
add_action( ‘updated_post_meta’, ‘plugin_name_sync_on_product_save’, 10, 4 );
function plugin_name_sync_on_product_save( $meta_id, $post_id, $meta_key, $meta_value ) {
if ( $meta_key == ‘_edit_lock’ ) { // we’ve been editing the post
if ( get_post_type( $post_id ) == ‘product’ ) { // we’ve been editing a product
$product = wc_get_product( $post_id );
// do something with this product
}
}
}
[/php]

List of all WordPress hooks

Woocommerce Product publish, update and delete hooks

[php]
add_action( ‘before_delete_post’, ‘plugin_name_new_posts’ );
add_action( ‘save_post’, ‘plugin_name_new_posts’ );

function plugin_name_new_posts($post_id){
$WC_Product = wc_get_product( $post_id);
}
[/php]

WooCommerce add or update products hook – WordPress Ecommerce Tutorial

[php]
add_action( ‘added_post_meta’, ‘your_function_name’, 10, 4 );
add_action( ‘updated_post_meta’, ‘your_function_name’, 10, 4 );
function your_function_name( $meta_id, $post_id, $meta_key, $meta_value ) {
if ( $meta_key == ‘_edit_lock’ ) { // we’ve been editing the post
if ( get_post_type( $post_id ) == ‘product’ ) { // we’ve been simple editing a product
$product_data = wc_get_product( $post_id );
// do something here
//code here…
}
}
}
[/php]

READ :  Access Control Allow Origin Solution - AngularJs PHP Python Express JS with ASP NET

woocommerce hook publish product

[php]
add_action(‘transition_post_status’, ‘your_function_name’, 10, 3);
function your_function_name($new_status, $old_status, $post) {
if(
$old_status != ‘publish’
&& $new_status == ‘publish’
&& !empty($post->ID)
&& in_array( $post->post_type,
array( ‘product’)
)
) {
//add some code here
}

}
[/php]

Woocommerce Action List

[php]
$topic_hooks = array(
‘coupon.created’ => array(
‘woocommerce_process_shop_coupon_meta’,
‘woocommerce_new_coupon’,
),
‘coupon.updated’ => array(
‘woocommerce_process_shop_coupon_meta’,
‘woocommerce_update_coupon’,
),
‘coupon.deleted’ => array(
‘wp_trash_post’,
),
‘coupon.restored’ => array(
‘untrashed_post’,
),
‘customer.created’ => array(
‘user_register’,
‘woocommerce_created_customer’,
‘woocommerce_new_customer’,
),
‘customer.updated’ => array(
‘profile_update’,
‘woocommerce_update_customer’,
),
‘customer.deleted’ => array(
‘delete_user’,
),
‘order.created’ => array(
‘woocommerce_new_order’,
),
‘order.updated’ => array(
‘woocommerce_update_order’,
‘woocommerce_order_refunded’,
),
‘order.deleted’ => array(
‘wp_trash_post’,
),
‘order.restored’ => array(
‘untrashed_post’,
),
‘product.created’ => array(
‘woocommerce_process_product_meta’,
‘woocommerce_new_product’,
‘woocommerce_new_product_variation’,
),
‘product.updated’ => array(
‘woocommerce_process_product_meta’,
‘woocommerce_update_product’,
‘woocommerce_update_product_variation’,
),
‘product.deleted’ => array(
‘wp_trash_post’,
),
‘product.restored’ => array(
‘untrashed_post’,
),
);
[/php]

READ :  Remove WooCommerce action Hook in Wordpress
Web Programming Tutorials Example with Demo

Read :

  • Jobs
  • Make Money
  • Programming

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Woo-commerce Product publish, update and delete hooks.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Related posts:

  1. WooCommerce Change or Remove Single Product Page Description Title
  2. Remove WooCommerce action Hook in WordPress
  3. Create a webhook using PHP WooCommerce Rest Api
  4. Retrieve a webhook using PHP WooCommerce Rest Api
PHP, Programming, Technology, wordpress Tags:WooCommerce hook on product updated or added, woocommerce hooks, woocommerce order notes hook, woocommerce price hook, woocommerce save_post product, woocommerce shipping calculator hook, woocommerce_add_to_cart, woocommerce_new_order, woocommerce_thankyou hook

Post navigation

Previous Post: Top 10 AngularJS interview questions and answers
Next Post: Restful insert update edit delete using Angularjs and PHP

Related Posts

  • Angularjs Scroll to top With Router Autoscroll
    Angularjs Scroll to top With Router Autoscroll Technology
  • Laravel Ignore duplicate record on insert Technology
  • C# Fibonacci Series Tutorial with Examples Technology
  • Laravel 6 Dynamic get and set config variables value Technology
  • The Future of AngularJS Framework Technology
  • AngularJS – How to Pass Parameters to Controllers on Initialization
    AngularJS – How to Pass Parameters to Controllers on Initialization Technology

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Account web hosting (1)
  • AngularJs (277)
  • Articles (143)
  • Asp.Net (49)
  • Astrology (2)
  • Attorney (7)
  • Auto Car Insurance (4)
  • Biography (2)
  • Business (9)
  • Business Insurance (3)
  • California (4)
  • Choose the web hosting (1)
  • Clothing (6)
  • cloud (8)
  • Cloud data storage (2)
  • Credit (1)
  • Dedicated hosting server web (1)
  • Dedicated server web hosting (1)
  • Dedicated web hosting (1)
  • Degree (11)
  • Design (9)
  • Differences shared hosting (1)
  • Donate (2)
  • Education (37)
  • Energy web hosting (1)
  • Entertainment (6)
  • Facts (12)
  • Fashion (3)
  • Finance (3)
  • Food (5)
  • full form (90)
  • Google Adsense (22)
  • Health (20)
  • Home Improvement (5)
  • Insurance (6)
  • Interview (2)
  • Jobs (6)
  • jquery (2)
  • jQuery (2)
  • Laravel (164)
  • Lawyer (4)
  • Lifestyle (6)
  • Loans (6)
  • Make Money (31)
  • Managed dedicated server (1)
  • Managed hosting solution (1)
  • Managed servers (1)
  • Marketing (8)
  • Mortgage (2)
  • Movies (21)
  • MySQL (180)
  • News (5)
  • Photography (1)
  • PHP (250)
  • Programming (18)
  • Quotes (75)
  • Real Estate (2)
  • SEO (9)
  • Shared web hosting (1)
  • Shayari (67)
  • Sports (5)
  • Status (34)
  • Stories (45)
  • suvichar (8)
  • Tech (3)
  • Technology (675)
  • Tips and Tricks (42)
  • Top Tranding (35)
  • Trading (28)
  • Travel (12)
  • Uncategorized (8)
  • VueJs (179)
  • Web Design (2)
  • WEB HOSTING (1)
  • Web hosting company (1)
  • Web hosting really (1)
  • Web hosting windows (1)
  • Which website hosting (1)
  • Wishes (13)
  • wordpress (15)

Categories

AngularJs (277) Articles (143) Asp.Net (49) Attorney (7) Business (9) Clothing (6) cloud (8) Degree (11) Design (9) Education (37) Entertainment (6) Facts (12) Food (5) full form (90) Google Adsense (22) Health (20) Home Improvement (5) Insurance (6) Jobs (6) Laravel (164) Lifestyle (6) Loans (6) Make Money (31) Marketing (8) Movies (21) MySQL (180) News (5) PHP (250) Programming (18) Quotes (75) SEO (9) Shayari (67) Sports (5) Status (34) Stories (45) suvichar (8) Technology (675) Tips and Tricks (42) Top Tranding (35) Trading (28) Travel (12) Uncategorized (8) VueJs (179) Wishes (13) wordpress (15)
  • laravel vue file upload,vue js 2.0 file upload,vue js file upload,laravel vue.js file upload,vuejs laravel image upload,vue axios upload file,vue file upload tutorial,jquery file upload vue
    Vue js upload file-Image upload and move using Laravel Technology
  • Laravel 6 get ip address from request Technology
  • cab full form – cab full form Kya Hai, Meaning and Abbreviation – What is the full form of cab full form? full form
  • Anime quotes Quotes
  • Vuejs Game Programming – fastest click GAME
    Vuejs Game Programming – fastest click GAME Technology
  •  Moderate Treks In India  Articles
  • 20 minion Quotes — Inspiring the Happy, Good and Funny in Life Quotes
  • Laravel Eloquent Join Multiple Table
    Laravel Eloquent Join Multiple Table Technology

Copyright © 2022 InfinityKnow.

Powered by PressBook News WordPress theme