[ad_1]
add_action( 'pmxi_saved_post', function( $id )
{
$import_id = ( isset( $_GET['id'] ) ? $_GET['id'] : ( isset( $_GET['import_id'] ) ? $_GET['import_id'] : 'new' ) );
// Only run for import IDs 329 and 212.
if ( $import_id == '329' || $import_id == '212' ) {
// get locations total stock
$locations_total_stock = \SLW\SRC\Helpers\SlwProductHelper::get_product_locations_stock_total( $id );
// update stock
update_post_meta( $id, '_stock', $locations_total_stock );
// update stock status
\SLW\SRC\Helpers\SlwProductHelper::update_wc_stock_status( $id );
}
}, 10, 1 );
Please check the inc/functions.php around line no. 245, this add_action thing “pmxi_saved_post” is already there. Please explain the following condition, is it specifically for your use-case or they recommended it for every user.
if ( $import_id == '329' || $import_id == '212' ) {
