Located in: shipwire_functions.php

Functions that call this hook: sync_products()

Arguments Accepted: $tracking, $inventory

Version Introduced: 3.8.9

Description: This action is triggered after shipwire tracking information is synced.

Code in context:

[php firstline=”631″ highlight=”641″]

foreach ( $inventory as $sku => $qty ) {

$sql = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = ‘_wpsc_sku’ AND meta_value = %s", $sku );

$queries[] = $sql;

$product_id = $wpdb->get_var( $sql );

$product_ids[] = $product_id;

$stock_updates = (int) update_post_meta( $product_id, ‘_wpsc_stock’, $qty );

$inventory_updates += $stock_updates;


do_action( ‘wpsc_shipwire_post_sync’, $tracking, $inventory );

$sync_response = array(

‘tracking’ => sprintf( _n( ‘Shipwire updated %d tracking number.’, ‘Shipwire updated %d tracking numbers.’, $tracking_updates, ‘wpsc’ ), $tracking_updates ),

‘inventory’ => sprintf( _n( ‘Shipwire updated inventory on %d product.’, ‘Shipwire updated inventory on %d products.’, $inventory_updates, ‘wpsc’ ), $inventory_updates ),