forked from soflyy/wp-all-import-action-reference
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpmxi_product_variation_saved.php
33 lines (29 loc) · 991 Bytes
/
pmxi_product_variation_saved.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
* ================================================
* Action: pmxi_product_variation_saved
* ================================================
*
* Called when WP All Import saves a variable product with the "Link all variations" option selected.
*
* @param $variation_id - The current variation post ID.
*
*/
add_action( 'pmxi_product_variation_saved', 'wpai_wp_all_import_variation_imported', 10, 1 );
function wpai_wp_all_import_variation_imported( $variation_id ){
// Code here.
}
// ----------------------------
// Example uses below
// ----------------------------
/**
* Example: Get post parent for variation.
*
*/
add_action( 'pmxi_product_variation_saved', 'wpai_wp_all_import_variation_imported', 10, 1 );
function wpai_wp_all_import_variation_imported( $variation_id ){
global $wpdb;
$table = $wpdb->posts;
$variation = $wpdb->get_row( "SELECT * FROM $table WHERE ID = " . $variation_id );
$parent_post = $variation->post_parent;
}