wpsc_refresh_item

Located in: cart.class.php

Functions that call this hook: refresh_item
Arguments Accepted: array( &$this )
Version Introduced: 3.8

Description: This hook is triggered right at the end of the refresh_item function. The function is responsible for updating any information that may have changed to the cart item.
for example – price, shipping, stock levels.

Code in context:
[php firstline=”1669″ highlight=”1712″]
$this->product_url = wpsc_product_url( $product_id );

if( ! is_array( $this->variation_values ) )
$attach_parent = $product_id;
else
$attach_parent = $wpdb->get_var( $wpdb->prepare("SELECT post_parent FROM $wpdb->posts WHERE ID = %d", $product_id ) );

$att_img_args = array(
‘post_type’ => ‘attachment’,
‘numberposts’ => 1,
‘post_parent’ => $attach_parent,
‘orderby’ => ‘menu_order’,
‘order’ => ‘DESC’
);

$attached_image = get_posts( $att_img_args );

if ( $attached_image != null )
$this->thumbnail_image = array_shift( $attached_image );

$product_files = (array) get_posts( array(
‘post_type’ => ‘wpsc-product-file’,
‘post_parent’ => $this->product_id,
‘numberposts’ => -1,
‘post_status’ => ‘inherit’
) );

if(count($product_files) > 0) {
$this->file_id = null;
$this->is_downloadable = true;
} else {
$this->file_id = null;
$this->is_downloadable = false;
}

if ( isset( $this->cart->selected_shipping_method ) && isset( $wpsc_shipping_modules[$this->cart->selected_shipping_method] ) && is_callable( array( $wpsc_shipping_modules[$this->cart->selected_shipping_method], "get_item_shipping" ) ) )
$this->shipping = $wpsc_shipping_modules[$this->cart->selected_shipping_method]->get_item_shipping( $this );

// update the claimed stock here
$this->update_claimed_stock();

do_action_ref_array( ‘wpsc_refresh_item’, array( &$this ) );

}
[/php]