Guest User

Untitled

a guest
Apr 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <?php
  2. add_action( 'added_post_meta', 'mp_sync_on_product_save', 10, 4 );
  3. add_action( 'updated_post_meta', 'mp_sync_on_product_save', 10, 4 );
  4. function mp_sync_on_product_save( $meta_id, $post_id, $meta_key, $meta_value ) {
  5. if ( $meta_key == '_edit_lock' ) { // we've been editing the post
  6. if ( get_post_type( $post_id ) == 'product' ) { // we've been editing a product
  7. $product = wc_get_product( $post_id );
  8. // do something with this product
  9. }
  10. }
  11. }
  12. ?>
Add Comment
Please, Sign In to add comment