API Filter Reference RSS feed for this section

the_product_tag_list

Located in: tagging_functions.php

Functions that call this hook: wpsc_get_the_product_tag_list()
Arguments Accepted: $tags
Version Introduced: 3.8.9

Description: Filter the tag list of the current product in the loop.

Code in context:
[php highlight="159" firstline="148"]
function wpsc_get_the_product_tag_list( $before = ”, $sep = ”, $after = ” ) {
global $post;

if ( ! $post->ID )
return false;

$tags = get_the_term_list( $post->ID, ‘product_tag’, $before, $sep, $after );

if ( empty( $tags ) )
return false;

return apply_filters( ‘the_product_tag_list’, $tags );
}
[/php]

Read Documentation ·

get_the_product_tags

Located in: tagging_functions.php

Functions that call this hook: wpsc_get_the_product_tags()
Arguments Accepted: $tags, $id
Version Introduced: 3.8.9

Description: Filter the tags associated with a certain product ID.

Code in context:
[php highlight="145" firstline="143"]
function wpsc_get_the_product_tags( $id = 0 ) {
$tags = get_the_terms( $id, ‘product_tag’ );
return apply_filters( ‘get_the_product_tags’, $tags, $id );
}
[/php]

Read Documentation ·

wpsc_specials_widget_no_items_message

Located in: special_widgets.php

Functions that call this hook: wpsc_specials()
Arguments Accepted: __( 'We currently have no items on special.', 'wpsc' )
Version Introduced: 3.8.9

Description: Filter the “no items” message on Product Specials Widget.

Code in context:
[php highlight="200" firstline="193"]
add_filter( ‘posts_join’, ‘_wpsc_filter_special_widget_join’ );
add_filter( ‘posts_where’, ‘_wpsc_filter_special_widget_where’ );
$special_products = new WP_Query( $args );
remove_filter( ‘posts_join’, ‘_wpsc_filter_special_widget_join’ );
remove_filter( ‘posts_where’, ‘_wpsc_filter_special_widget_where’ );

if ( ! $special_products->post_count ) {
echo apply_filters( ‘wpsc_specials_widget_no_items_message’, __( ‘We currently have no items on special.’, ‘wpsc’ ) );
return;
}

$product_ids = array();
[/php]

Read Documentation ·

wpsc_shipwire_send_tracking_email

Located in: shipwire_functions.php

Functions that call this hook: sync_products()
Arguments Accepted: true, $order_id, $tracking_number
Version Introduced: 3.8.9

Description: Whether to send the tracking email.

Code in context:
[php highlight="623" firstline="607"]
foreach ( $tracking as $order_id => $tracking_number ) {
$tracking_numbers = array_keys( $tracking_number );
$update = (int) $wpdb->update(
WPSC_TABLE_PURCHASE_LOGS,
array(
‘track_id’ => $tracking_numbers[0]
),
array(
‘id’ => $order_id
),
‘%s’,
‘%d’
);

$tracking_updates += $update;

if ( apply_filters( ‘wpsc_shipwire_send_tracking_email’, true, $order_id, $tracking_number ) && $update )
self::_send_tracking_email( $order_id, $tracking_number );
}
[/php]

Read Documentation ·

wpsc_shipwire_rates_cache_expiration

Located in: shipwire_functions.php

Functions that call this hook: fetch_fresh_quotes()
Arguments Accepted: 60 * 60
Version Introduced: 3.8.9

Description: Filter the the expiration for the transient, defaults to one hour.

Code in context:
[php highlight="561" firstline="541"]
public static function fetch_fresh_quotes() {
$quotes = simplexml_load_string( self::send_shipping_request( self::get_shipping_xml() ) );
$methods = array();

$quotes = is_object( $quotes ) ? $quotes->Order->Quotes->Quote : $methods;

if ( ! is_object( $quotes ) )
return $methods;

foreach ( $quotes as $quote ) {

$service = (string) $quote['method'];
$service = convert_code_to_service( $service );
$cost = (string) $quote->Cost;

$methods[$service] = $cost;
}

$methods = apply_filters( ‘wpsc_shipwire_methods’, $methods, $quotes );

set_transient( self::get_cache_key(), $methods, apply_filters( ‘wpsc_shipwire_rates_cache_expiration’, 60 * 60 ) );

return $methods;
}
[/php]

Read Documentation ·

wpsc_shipwire_methods

Located in: shipwire_functions.php

Functions that call this hook: fetch_fresh_quotes() ()
Arguments Accepted: $methods, $quotes
Version Introduced: 3.8.9

Description: Filter the methods returns – the $methods array and $quotes object are both passed to the filter

Code in context:
[php highlight="559" firstline="541"]
public static function fetch_fresh_quotes() {
$quotes = simplexml_load_string( self::send_shipping_request( self::get_shipping_xml() ) );
$methods = array();

$quotes = is_object( $quotes ) ? $quotes->Order->Quotes->Quote : $methods;

if ( ! is_object( $quotes ) )
return $methods;

foreach ( $quotes as $quote ) {

$service = (string) $quote['method'];
$service = convert_code_to_service( $service );
$cost = (string) $quote->Cost;

$methods[$service] = $cost;
}

$methods = apply_filters( ‘wpsc_shipwire_methods’, $methods, $quotes );

set_transient( self::get_cache_key(), $methods, apply_filters( ‘wpsc_shipwire_rates_cache_expiration’, 60 * 60 ) );

return $methods;
}
[/php]

Read Documentation ·

get_tracking_xml

Located in: shipwire_functions.php

Functions that call this hook: get_tracking_xml() ()
Arguments Accepted: $xml
Version Introduced: 3.8.9

Description: Filter XML output of Shipwire tracking.

Code in context:
[php highlight="395" firstline="385"]
public static function get_tracking_xml() {

$xml = ‘<?xml version="1.0" encoding="utf-8"?>’;
$xml .= ‘<TrackingUpdate>’;
$xml .= ‘<EmailAddress>’ . self::$email . ‘</EmailAddress>’;
$xml .= ‘<Password>’ . self::$passwd . ‘</Password>’;
$xml .= ‘<Server>’ . self::$server . ‘</Server>’;
$xml .= ‘<Bookmark>’ . apply_filters( ‘wpsc_shipwire_tracking_bookmark’, ’1′ ) .’</Bookmark>’;
$xml .= ‘</TrackingUpdate>’;

return apply_filters( ‘get_tracking_xml’, $xml );
}

[/php]

Read Documentation ·

wpsc_shipwire_tracking_bookmark

Located in: shipwire_functions.php

Functions that call this hook: get_tracking_xml() ()
Arguments Accepted: 1
Version Introduced: 3.8.9

Description: Filter tracking bookmark value.

Code in context:
[php highlight="392" firstline="385"]
public static function get_tracking_xml() {

$xml = ‘<?xml version="1.0" encoding="utf-8"?>’;
$xml .= ‘<TrackingUpdate>’;
$xml .= ‘<EmailAddress>’ . self::$email . ‘</EmailAddress>’;
$xml .= ‘<Password>’ . self::$passwd . ‘</Password>’;
$xml .= ‘<Server>’ . self::$server . ‘</Server>’;
$xml .= ‘<Bookmark>’ . apply_filters( ‘wpsc_shipwire_tracking_bookmark’, ’1′ ) .’</Bookmark>’;
$xml .= ‘</TrackingUpdate>’;

return apply_filters( ‘get_tracking_xml’, $xml );
}

[/php]

Read Documentation ·

get_inventory_xml

Located in: shipwire_functions.php

Functions that call this hook: get_inventory_xml() ()
Arguments Accepted: false
Version Introduced: 3.8.9

Description: Filter the XML output for Shipwire Inventory.

Code in context:
[php highlight="364" firstline="350"]
public static function get_inventory_xml( $product_code = ” ) {

$xml = ‘<?xml version="1.0" encoding="utf-8"?>’;
$xml .= ‘<InventoryUpdate>’;
$xml .= ‘<EmailAddress>’ . self::$email . ‘</EmailAddress>’;
$xml .= ‘<Password>’ . self::$passwd . ‘</Password>’;
$xml .= ‘<Server>’ . self::$server . ‘</Server>’;

if ( false !== ( $warehouse = apply_filters( ‘wpsc_shipwire_inventory_warehouse’, false ) ) )
$xml .= ‘<Warehouse>’ . $warehouse . ‘</Warehouse>’;

$xml .= ‘<ProductCode>’ . $product_code . ‘</ProductCode>’;
$xml .= ‘</InventoryUpdate>’;

return apply_filters( ‘get_inventory_xml’, $xml );
}
[/php]

Read Documentation ·

wpsc_shipwire_inventory_warehouse

Located in: shipwire_functions.php

Functions that call this hook: get_inventory_xml() ()
Arguments Accepted: false
Version Introduced: 3.8.9

Description: Ability to query inventory from specific warehouse on ‘wpsc_shipwire_inventory_warehouse’.

Code in context:
[php highlight="358" firstline="350"]
public static function get_inventory_xml( $product_code = ” ) {

$xml = ‘<?xml version="1.0" encoding="utf-8"?>’;
$xml .= ‘<InventoryUpdate>’;
$xml .= ‘<EmailAddress>’ . self::$email . ‘</EmailAddress>’;
$xml .= ‘<Password>’ . self::$passwd . ‘</Password>’;
$xml .= ‘<Server>’ . self::$server . ‘</Server>’;

if ( false !== ( $warehouse = apply_filters( ‘wpsc_shipwire_inventory_warehouse’, false ) ) )
$xml .= ‘<Warehouse>’ . $warehouse . ‘</Warehouse>’;

$xml .= ‘<ProductCode>’ . $product_code . ‘</ProductCode>’;
$xml .= ‘</InventoryUpdate>’;

return apply_filters( ‘get_inventory_xml’, $xml );
}
[/php]

Read Documentation ·

get_order_xml

Located in: shipwire_functions.php

Functions that call this hook: get_order_xml()
Arguments Accepted: $xml, $log_id
Version Introduced: 3.8.9

Description: Filter the XML output of the Shipwire request.

Code in context:
[php highlight="210" firstline="201"]
$xml .= ‘</Item>’;

$num++;

}

$xml .=’</Order>’;
$xml .=’</OrderList>’;

return apply_filters( ‘get_order_xml’, $xml, $log_id );
[/php]

Read Documentation ·

wpsc_shipwire_show_dimensions

Located in: shipwire_functions.php

Functions that call this hook: get_order_xml()
Arguments Accepted: false
Version Introduced: 3.8.9

Description: Whether to send dimensions value to Shipwire.

Code in context:
[php highlight="179" firstline="176"]
$num = 0;

$show_declared_value = apply_filters( ‘wpsc_shipwire_show_declared_value’, true );
$show_dimensions = apply_filters( ‘wpsc_shipwire_show_dimensions’, false );

foreach ( $products as $product ) {

if ( $product->no_shipping )
continue;
[/php]

Read Documentation ·

wpsc_shipwire_show_declared_value

Located in: shipwire_functions.php

Functions that call this hook: get_order_xml()
Arguments Accepted: false
Version Introduced: 3.8.9

Description: Whether to send declared value to Shipwire.

Code in context:
[php highlight="178" firstline="176"]
$num = 0;

$show_declared_value = apply_filters( ‘wpsc_shipwire_show_declared_value’, true );
$show_dimensions = apply_filters( ‘wpsc_shipwire_show_dimensions’, false );

foreach ( $products as $product ) {

if ( $product->no_shipping )
continue;
[/php]

Read Documentation ·

wpsc_shipwire_show_affiliate

Located in: shipwire_functions.php

Functions that call this hook: get_order_xml()
Arguments Accepted: false
Version Introduced: 3.8.9

Description: Whether to send referring affiliate to Shipwire.

Code in context:
[php highlight="155" firstline="149"]
$xml = ‘<?xml version="1.0" encoding="utf-8"?>’;
$xml .= ‘<OrderList>’;
$xml .= ‘<EmailAddress>’ . self::$email . ‘</EmailAddress>’;
$xml .= ‘<Password>’ . self::$passwd . ‘</Password>’;
$xml .= ‘<Server>’ . self::$server . ‘</Server>’;

$referrer = apply_filters( ‘wpsc_shipwire_show_affiliate’, false );

if ( $referrer )
$xml .= ‘<Referer>’ . $referrer . ‘</Referer>’;
}
[/php]

Read Documentation ·

wpsc_paypal_pro_accepted_card_types

Located in: paypal-pro.merchant.php

Functions that call this hook: form_paypal_pro()
Arguments Accepted: $card_types
Version Introduced: 3.8.9

Description: Filter the acceptable cart types for PayPal Pro.

Code in context:
[php highlight="551" firstline="545"]
$card_types = array(
‘Visa’ => __( ‘Visa’, ‘wpsc’ ),
‘Mastercard’ => __( ‘MasterCard’, ‘wpsc’ ),
‘Discover’ => __( ‘Discover’, ‘wpsc’ ),
‘Amex’ => __( ‘Amex’, ‘wpsc’ ),
);
$card_types = apply_filters( ‘wpsc_paypal_pro_accepted_card_types’, $card_types );
foreach ( $card_types as $type => $title ) {
$output .= sprintf( ‘<option value="%1$s">%2$s</option>’, $type, esc_html( $title ) );
}
[/php]

Read Documentation ·

wpsc_get_the_post_id_by_shortcode

Located in: theme.functions.php

Functions that call this hook: wpsc_get_the_post_id_by_shortcode()
Arguments Accepted: $id, $shortcode
Version Introduced: 3.8.9

Description: Filter the post ID corresponding to a certain shortcode.

Code in context:
[php highlight="1259" firstline="1234"]
function wpsc_get_the_post_id_by_shortcode( $shortcode ) {

$shortcode_options = array(
‘[productspage]‘ => ‘product_list_url’,
‘[shoppingcart]‘ => ‘shopping_cart_url’,
‘[checkout]‘ => ‘shopping_cart_url’,
‘[transactionresults]‘ => ‘transact_url’,
‘[userlog]‘ => ‘user_account_url’
);

if ( ! isset( $shortcode_options[$shortcode] ) )
return 0;

$page_ids = get_option( ‘wpsc_shortcode_page_ids’, false );

if ( $page_ids === false ) {
wpsc_update_permalink_slugs();
$page_ids = get_option( ‘wpsc_shortcode_page_ids’, false );
}

$post_id = isset( $page_ids[$shortcode] ) ? $page_ids[$shortcode] : null;

// For back compat
$post_id = apply_filters( ‘wpec_get_the_post_id_by_shortcode’, $post_id );

return apply_filters( ‘wpsc_get_the_post_id_by_shortcode’, $post_id, $shortcode );

}
[/php]

Read Documentation ·

wpsc_get_transaction_html_output

Located in: purchase-log.helpers.php

Functions that call this hook: wpsc_get_transaction_html_output()
Arguments Accepted: $output, $notification
Version Introduced: 3.8.9

Description: Filter transaction result output.

Code in context:
[php highlight="248" firstline="238"]
function wpsc_get_transaction_html_output( $purchase_log ) {
if ( ! is_object( $purchase_log ) )
$purchase_log = new WPSC_Purchase_Log( $purchase_log );

if ( ! $purchase_log->is_transaction_completed() && ! $purchase_log->is_order_received() )
return ”;

$notification = new WPSC_Purchase_Log_Customer_HTML_Notification( $purchase_log );
$output = $notification->get_html_message();

$output = apply_filters( ‘wpsc_get_transaction_html_output’, $output, $notification );
return $output;
}
[/php]

Read Documentation ·

wpsc_get_purchase_log_html_table

Located in: purchase-log.helpers.php

Functions that call this hook: wpsc_get_purchase_log_html_table()
Arguments Accepted: $output, $headings, $rows
Version Introduced: 3.8.9

Description: Filter purchase log HTML (used for notifications) table output.

Code in context:
[php highlight="163" firstline="161"]
<?php
$output = ob_get_clean();
$output = apply_filters( ‘wpsc_get_purchase_log_html_table’, $output, $headings, $rows );
return $output;
[/php]

Read Documentation ·

wpsc_purchase_log_insert_data

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::save()
Arguments Accepted: $data
Version Introduced: 3.8.9

Description: Filter purchase log’s values before they are inserted into the database.

Code in context:
[php highlight="536" firstline="518"]
} else {
do_action( ‘wpsc_purchase_log_pre_insert’ );
$data = apply_filters( ‘wpsc_purchase_log_insert_data’, $this->data );
$format = $this->get_data_format( $data );
$result = $wpdb->insert( WPSC_TABLE_PURCHASE_LOGS, $data, $format );

if ( $result ) {
$this->set( ‘id’, $wpdb->insert_id );

// set $this->args so that properties can be lazy loaded right after
// the row is inserted into the db
$this->args = array(
‘col’ => ‘id’,
‘value’ => $this->get( ‘id’ ),
);
}

do_action( ‘wpsc_purchase_log_insert’, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_update_data

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::save()
Arguments Accepted: $data
Version Introduced: 3.8.9

Description: Filter purchase log’s values before they are updated into the database.

Code in context:
[php highlight="514" firstline="509"]
if ( $where_col ) {
$where_val = $this->args['value'];
$where_format = self::get_column_format( $where_col );
do_action( ‘wpsc_purchase_log_pre_update’, $this );
self::delete_cache( $where_val, $where_col );
$data = apply_filters( ‘wpsc_purchase_log_update_data’, $this->data );
$format = $this->get_data_format( $data );
$result = $wpdb->update( WPSC_TABLE_PURCHASE_LOGS, $data, array( $where_col => $where_val ), $format, array( $where_format ) );
do_action( ‘wpsc_purchase_log_update’, $this );
} else {
[/php]

Read Documentation ·

wpsc_purchase_log_set_properties

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::set()
Arguments Accepted: $properties, $this
Version Introduced: 3.8.9

Description: Filter values before they are set as purchase log’s properties.

Code in context:
[php highlight="457" firstline="447"]
public function set( $key, $value = null ) {
if ( is_array( $key ) ) {
$properties = $key;
} else {
if ( is_null( $value ) )
return $this;

$properties = array( $key => $value );
}

$properties = apply_filters( ‘wpsc_purchase_log_set_properties’, $properties, $this );

if ( array_key_exists( ‘processed’, $properties ) ) {
$this->previous_status = $this->get( ‘processed’ );

if ( $properties['processed'] != $this->previous_status )
$this->is_status_changed = true;
}

$this->data = array_merge( $this->data, $properties );
return $this;
}
[/php]

Read Documentation ·

wpsc_purchase_log_gateway_data

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::get_gateway_data()
Arguments Accepted: $this->gateway_data, $this->data
Version Introduced: 3.8.9

Description: Filter purchase log data (formatted for payment gateways) before it is returned.

Code in context:
[php highlight="431" firstline="423"]
if ( $from_currency ) {
// adjust total amount in case there’s slight decimal error
$total = $subtotal + $shipping + $this->gateway_data['tax'] – $this->gateway_data['discount'];
if ( $this->gateway_data['amount'] != $total )
$this->gateway_data['amount'] = $total;
}

$this->gateway_data = apply_filters( ‘wpsc_purchase_log_gateway_data’, $this->gateway_data, $this->get_data() );
return $this->gateway_data;
[/php]

Read Documentation ·

wpsc_purchase_log_get_data

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::get_data()
Arguments Accepted: $this->data, $this
Version Introduced: 3.8.9

Description: Filter purchase log data before it is returned.

Code in context:
[php highlight="383" firstline="387"]
public function get_data() {
if ( empty( $this->data ) )
$this->fetch();

return apply_filters( ‘wpsc_purchase_log_get_data’, $this->data, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_get_property

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::get()
Arguments Accepted: $value, $key, $this
Version Introduced: 3.8.9

Description: Filter purchase log property before it is returned.

Code in context:
[php highlight="346" firstline="358"]
public function get( $key ) {
// lazy load the purchase log row if it’s not fetched from the database yet
if ( empty( $this->data ) || ! array_key_exists( $key, $this->data ) )
$this->fetch();

if ( isset( $this->data[$key] ) )
$value = $this->data[$key];
elseif ( isset( $this->meta_data[$key] ) )
$value = $this->meta_data[$key];
else
$value = null;

return apply_filters( ‘wpsc_purchase_log_get_property’, $value, $key, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_data

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::fetch()
Arguments Accepted: $data
Version Introduced: 3.8.9

Description: Filter purchase log data returned by the database before it is used to update the cache.

Code in context:
[php highlight="312" firstline="310"]
if ( $data = $wpdb->get_row( $sql, ARRAY_A ) ) {
$this->exists = true;
$this->data = apply_filters( ‘wpsc_purchase_log_data’, $data );
$this->cart_contents = $this->get_cart_contents();

$this->set_meta_props();
self::update_cache( $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_customer_html_notification_raw_message

Located in: purchase-log-notification.class.php

Functions that call this hook: WPSC_Purchase_Log_Customer_HTML_Notification::get_raw_message()
Arguments Accepted: $raw_message, $this
Version Introduced: 3.8.9

Description: Filter the customer HTML purchase notification’s raw message (transaction results’ page content) before placeholders are replaced by real values.

Code in context:
[php highlight="426" firstline="416"]
public function get_raw_message() {
$raw_message = apply_filters( ‘wpsc_pre_transaction_results’, ”, $this );
if ( $this->purchase_log->get( ‘processed’ ) == WPSC_Purchase_Log::ORDER_RECEIVED )
$raw_message = __( ‘Thank you, your purchase is pending, you will be sent an email once the order clears.’, ‘wpsc’ ) . "\n\r";

$raw_message .= get_option( ‘wpsc_email_receipt’ );
$raw_message = $this->maybe_add_discount( $raw_message );

// preserve pre-3.8.9 filter hooks
$raw_message = apply_filters( ‘wpsc_transaction_result_message_html’, $raw_message );
return apply_filters( ‘wpsc_purchase_log_customer_html_notification_raw_message’, $raw_message, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_admin_notification_raw_message

Located in: purchase-log-notification.class.php

Functions that call this hook: WPSC_Purchase_Log_Admin_Notification::get_raw_message()
Arguments Accepted: $raw_message, $this
Version Introduced: 3.8.9

Description: Filter the admin purchase notification’s raw message (admin report) before placeholders are replaced by real values.

Code in context:
[php highlight="384" firstline="398"]
// Checkout fields
$message .= "\r\n";
foreach ( $data as $section ) {
if ( empty( $section['fields'] ) )
continue;
$message .= "<strong>{$section['title']}</strong>\r\n";
foreach ( $section['fields'] as $field ) {
$message .= $field->name . ‘ : ‘ . $field->value . "\r\n";
}
$message .= "\r\n";
}

// preserve pre-3.8.9 hooks
$message = apply_filters( ‘wpsc_transaction_result_report’, $message );
return apply_filters( ‘wpsc_purchase_log_admin_notification_raw_message’, $message, $this );
[/php]

Read Documentation ·

wpsc_purchase_log_customer_notification_raw_message

Located in: purchase-log-notification.class.php

Functions that call this hook: WPSC_Purchase_Log_Customer_Notification::get_raw_message()
Arguments Accepted: $raw_message, $this
Version Introduced: 3.8.9

Description: Filter the customer purchase notification’s raw message (purchase receipt) before placeholders are replaced by real values.

Code in context:
[php highlight="297" firstline="287"]
public function get_raw_message() {
$raw_message = ”;

if ( $this->purchase_log->get( ‘processed’ ) == WPSC_Purchase_Log::ORDER_RECEIVED )
$raw_message = __( ‘Thank you, your purchase is pending, you will be sent an email once the order clears.’, ‘wpsc’ ) . "\n\r";

$raw_message .= get_option( ‘wpsc_email_receipt’ );
$raw_message = $this->maybe_add_discount( $raw_message );
// pre-3.8.9 filter hook
$raw_message = apply_filters( ‘wpsc_transaction_result_message’, $raw_message );
return apply_filters( ‘wpsc_purchase_log_customer_notification_raw_message’, $raw_message, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_notification_html_args

Located in: purchase-log-notification.class.php

Functions that call this hook: get_html_args()
Arguments Accepted: $this->html_args, $this
Version Introduced: 3.8.9

Description: Filter the placeholder arguments for html notification.

Code in context:
[php highlight="198" firstline="191"]
private function get_html_args() {
$common_args = $this->get_common_args();
$common_args = array_map( ‘esc_html’, $common_args );
$this->html_product_list = $this->create_html_product_list();
$this->html_args = array(
‘product_list’ => $this->html_product_list,
);
$this->html_args = apply_filters( ‘wpsc_purchase_log_notification_html_args’, $this->html_args, $this );
return array_merge( $common_args, $this->html_args );
}
[/php]

Read Documentation ·

wpsc_purchase_log_notification_plaintext_args

Located in: purchase-log-notification.class.php

Functions that call this hook: get_plaintext_args()
Arguments Accepted: $this->plaintext_args, $this
Version Introduced: 3.8.9

Description: Filter the placeholder arguments for plaintext notification.

Code in context:
[php highlight="187" firstline="182"]
private function get_plaintext_args() {
$this->plaintext_product_list = $this->create_plaintext_product_list();
$this->plaintext_args = array(
‘product_list’ => $this->plaintext_product_list,
);
$this->plaintext_args = apply_filters( ‘wpsc_purchase_log_notification_plaintext_args’, $this->plaintext_args, $this );
return array_merge( $this->get_common_args(), $this->plaintext_args );
}
[/php]

Read Documentation ·

wpsc_email_product_list_html_custom_message

Located in: purchase-log-notification.class.php

Functions that call this hook: create_html_product_list()
Arguments Accepted: __( 'Customization for %s', 'wpsc' )
Version Introduced: 3.8.9

Description: Filter the custom message heading in plain text purchase notification.

Code in context:
[php highlight="159" firstline="155"]
foreach ( $this->purchase_log->get_cart_contents() as $cart_item ) {
if ( empty( $cart_item->custom_message ) )
continue;

$custom_message_string = apply_filters( ‘wpsc_email_product_list_html_custom_message’, __( ‘Customization for %s’, ‘wpsc’ ) );
$output .= ‘<hr />’;
$output .= ‘<p><strong>’ . sprintf( $custom_message_string, esc_html( $cart_item->name ) ) . ‘</strong></p>’;
$output .= wpautop( esc_html( $cart_item->custom_message ) );
}
[/php]

Read Documentation ·

wpsc_email_product_list_plaintext_custom_message

Located in: purchase-log-notification.class.php

Functions that call this hook: create_plaintext_product_list()
Arguments Accepted: __( 'Customization for %s', 'wpsc' )
Version Introduced: 3.8.9

Description: Filter the custom message heading in plain text purchase notification.

Code in context:
[php highlight="127" firstline="123"]
foreach ( $this->purchase_log->get_cart_contents() as $cart_item ) {
if ( empty( $cart_item->custom_message ) )
continue;

$custom_message_string = apply_filters( ‘wpsc_email_product_list_plaintext_custom_message’, __( ‘Customization for %s’, ‘wpsc’ ) );
$output .= "\r\n" . ‘=== ‘ . sprintf( $custom_message_string, $cart_item->name ) . ‘ ===’ . "\r\n";
$output .= $cart_item->custom_message;
$output .= "\r\n";
}
[/php]

Read Documentation ·

wpsc_purchase_log_notification_product_table_args

Located in: purchase-log-notification.class.php

Functions that call this hook: get_table_args()
Arguments Accepted: $args, $this
Version Introduced: 3.8.9

Description: Filter the array containing default arguments to generate the product list table used in purchase notifications.

Code in context:
[php firstline="65" highlight="116"]
private function get_table_args() {
$log_id = $this->purchase_log->get( ‘id’ );
$log_data = $this->purchase_log->get_data();
$rows = array();

$headings = array(
_x( ‘Name’ , ‘purchase log notification table heading’, ‘wpsc’ ) => ‘left’,
_x( ‘Price’ , ‘purchase log notification table heading’, ‘wpsc’ ) => ‘right’,
_x( ‘Quantity’ , ‘purchase log notification table heading’, ‘wpsc’ ) => ‘right’,
_x( ‘Item Total’ , ‘purchase log notification table heading’, ‘wpsc’ ) => ‘right’,
);

$has_additional_details = false;
$additional_details = array();

foreach( $this->purchase_log->get_cart_contents() as $item ) {
$cart_item_array = array(
‘purchase_id’ => $log_id,
‘cart_item’ => (array) $item,
‘purchase_log’ => $log_data,
);

// legacy code, which Gary honestly doesn’t fully understand because it just doesn’t make sense
// prior to 3.8.9, these actions are called on each product item. Don’t really know what they do.
do_action( ‘wpsc_transaction_result_cart_item’, $cart_item_array );
do_action( ‘wpsc_confirm_checkout’, $log_id );

// then there’s also this annoying apply_filters call, which is apparently not the best example
// of how to use it, but we have to preserve them anyways
$additional_content = apply_filters( ‘wpsc_transaction_result_content’, array( "purchase_id" => $log_id, "cart_item" => $item, "purchase_log" => $log_data ) );
if ( ! is_string( $additional_content ) )
$additional_content = ”;
else
$has_additional_details = true;
$additional_details[] = $additional_content;

$item_total = $item->quantity * $item->price;
$item_total = wpsc_currency_display( $item_total , array( ‘display_as_html’ => false ) );
$item_price = wpsc_currency_display( $item->price, array( ‘display_as_html’ => false ) );
$rows[] = array( $item->name, $item_price, $item->quantity, $item_total );
}

// Preserve the ‘wpsc_transaction_result_content’ filter for backward compat
if ( $has_additional_details ) {
$headings[] = __( ‘Additional Details’, ‘wpsc’ );
foreach ( $rows as $index => $row ) {
$rows[] = $additional_details[$index];
}
}

$table_args = array( ‘headings’ => $headings, ‘rows’ => $rows );
return apply_filters( ‘wpsc_purchase_log_notification_product_table_args’, $table_args, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_notification_common_args

Located in: purchase-log-notification.class.php

Functions that call this hook: get_common_args()
Arguments Accepted: $args, $this
Version Introduced: 3.8.9

Description: Filter the array containing default placeholders and values for purchase notifications (purchase receipts, admin sales report).

Code in context:
[php firstline="36" highlight="62"]
$args = array(
// Legacy tags
// These tags are dumb because they force the string to go with the amount, giving no
// control to the user. Unfortunately we still have to support those for the next decade.
‘purchase_id’ => sprintf( __( "Purchase # %s" , ‘wpsc’ ), $this->purchase_log->get( ‘id’ ) ) . "\r\n",
‘total_tax’ => sprintf( __( ‘Total Tax: %s’ , ‘wpsc’ ), $tax ) . "\r\n",
‘total_shipping’ => sprintf( __( ‘Total Shipping: %s’, ‘wpsc’ ), $shipping ) . "\r\n",
‘total_price’ => sprintf( __( ‘Total: %s’ , ‘wpsc’ ), $total ) . "\r\n",
‘shop_name’ => get_option( ‘blogname’ ),
‘find_us’ => $this->purchase_log->get( ‘find_us’ ),
‘discount’ => sprintf( __( ‘Discount Amount: %s (%s)’, ‘wpsc’ ), $discount, $this->purchase_log->get( ‘discount_data’ ) ) . "\r\n",

// New tags
‘coupon_code’ => $this->purchase_log->get( ‘discount_data’ ),
‘transaction_id’ => $this->purchase_log->get( ‘transactid’ ),
‘purchase_log_id’ => $this->purchase_log->get( ‘id’ ),
‘payment_method’ => $this->purchase_log->get( ‘gateway_name’ ),
‘shipping_method’ => $this->purchase_log->get( ‘shipping_method_name’ ),
‘shipping_option’ => $this->purchase_log->get( ‘shipping_option_name’ ),
‘discount_amount’ => $discount,
‘tax’ => $tax,
‘shipping’ => $shipping,
‘total’ => $total,
‘subtotal’ => $subtotal,
);

return apply_filters( ‘wpsc_purchase_log_notification_common_args’, $args, $this );
[/php]

Read Documentation ·

wpsc_the_product_price_display_you_save_amount_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $you_save_amount_class, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “You Save” amount span element.

Code in context:
[php firstline="2001" highlight="2002"]
$you_save_class = apply_filters( ‘wpsc_the_product_price_display_you_save_class’, $you_save_class, $id );
$you_save_amount_class = apply_filters( ‘wpsc_the_product_price_display_you_save_amount_class’, $you_save_amount_class, $id );
$attributes = ‘class="’ . esc_attr( $you_save_class ) . ‘"’;
if ( ! $show_you_save )
$attributes .= ‘ style="display:none;"’;
$you_save_before = sprintf( $you_save_before, $attributes );
$you_save_amount_before = sprintf( $you_save_amount_before, esc_attr( $you_save_amount_class ), esc_attr( $you_save_amount_id ) );[/php]

Read Documentation ·

wpsc_the_product_price_display_you_save_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $you_save_class, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “You Save” span element.

Code in context:
[php firstline="2001" highlight="2001"]
$you_save_class = apply_filters( ‘wpsc_the_product_price_display_you_save_class’, $you_save_class, $id );
$you_save_amount_class = apply_filters( ‘wpsc_the_product_price_display_you_save_amount_class’, $you_save_amount_class, $id );
$attributes = ‘class="’ . esc_attr( $you_save_class ) . ‘"’;
if ( ! $show_you_save )
$attributes .= ‘ style="display:none;"’;
$you_save_before = sprintf( $you_save_before, $attributes );
$you_save_amount_before = sprintf( $you_save_amount_before, esc_attr( $you_save_amount_class ), esc_attr( $you_save_amount_id ) );[/php]

Read Documentation ·

wpsc_the_product_price_display_price_amount_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $price_amount_lass, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “Price” amount span element.

Code in context:
[php firstline="1996" highlight="1997"]
$price_class = apply_filters( ‘wpsc_the_product_price_display_price_class’, esc_attr( $price_class ), $id );
$price_amount_class = apply_filters( ‘wpsc_the_product_price_display_price_amount_class’, esc_attr( $price_amount_class ), $id );
$price_before = sprintf( $price_before, esc_attr( $price_class ) );
$price_amount_before = sprintf( $price_amount_before, esc_attr( $price_amount_class ), esc_attr( $price_amount_id ) );
[/php]

Read Documentation ·

wpsc_the_product_price_display_price_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $price_class, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “Price” span element.

Code in context:
[php firstline="1996" highlight="1996"]
$price_class = apply_filters( ‘wpsc_the_product_price_display_price_class’, esc_attr( $price_class ), $id );
$price_amount_class = apply_filters( ‘wpsc_the_product_price_display_price_amount_class’, esc_attr( $price_amount_class ), $id );
$price_before = sprintf( $price_before, esc_attr( $price_class ) );
$price_amount_before = sprintf( $price_amount_before, esc_attr( $price_amount_class ), esc_attr( $price_amount_id ) );
[/php]

Read Documentation ·

wpsc_the_product_price_display_old_price_amount_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $old_price_amount_class, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “Old Price” amount span element.

Code in context:
[php firstline="1988" highlight="1989"]
$old_price_class = apply_filters( ‘wpsc_the_product_price_display_old_price_class’, $old_price_class, $id );
$old_price_amount_class = apply_filters( ‘wpsc_the_product_price_display_old_price_amount_class’, $old_price_amount_class, $id );
$attributes = ‘class="’ . esc_attr( $old_price_class ) . ‘"’;
if ( ! $show_old_price )
$attributes .= ‘ style="display:none;"’;
$old_price_before = sprintf( $old_price_before, $attributes );
$old_price_amount_before = sprintf( $old_price_amount_before, esc_attr( $old_price_amount_class ), esc_attr( $old_price_amount_id ) );
[/php]

Read Documentation ·

wpsc_the_product_price_display_old_price_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $old_price_class, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “Old Price” span element.

Code in context:
[php firstline="1988" highlight="1988"]
$old_price_class = apply_filters( ‘wpsc_the_product_price_display_old_price_class’, $old_price_class, $id );
$old_price_amount_class = apply_filters( ‘wpsc_the_product_price_display_old_price_amount_class’, $old_price_amount_class, $id );
$attributes = ‘class="’ . esc_attr( $old_price_class ) . ‘"’;
if ( ! $show_old_price )
$attributes .= ‘ style="display:none;"’;
$old_price_before = sprintf( $old_price_before, $attributes );
$old_price_amount_before = sprintf( $old_price_amount_before, esc_attr( $old_price_amount_class ), esc_attr( $old_price_amount_id ) );
[/php]

Read Documentation ·

wpsc_preview_image_bgcolor

Located in: misc.functions.php

Functions that call this hook: nzshpcrt_display_preview_image()
Arguments Accepted: array( 255, 255, 255 )
Version Introduced: 3.8.9

Description: Specify the background color of the preview image.

Code in context:
[php firstline="408" highlight="409"]
// Create temp resized image
$bgcolor_default = apply_filters( ‘wpsc_preview_image_bgcolor’, array( 255, 255, 255 ) );
$temp_img = ImageCreateTrueColor( $temp_w, $temp_h );
$bgcolor = ImageColorAllocate( $temp_img, $bgcolor_default[0], $bgcolor_default[1], $bgcolor_default[2] ) ;
ImageFilledRectangle( $temp_img, 0, 0, $temp_w, $temp_h, $bgcolor );
ImageAlphaBlending( $temp_img, TRUE );
ImageCopyResampled( $temp_img, $src_img, 0, 0, 0, 0, $temp_w, $temp_h, $source_w, $source_h );

$dst_img = ImageCreateTrueColor( $width, $height );
$bgcolor = ImageColorAllocate( $dst_img, $bgcolor_default[0], $bgcolor_default[1], $bgcolor_default[2] );
ImageFilledRectangle( $dst_img, 0, 0, $width, $height, $bgcolor );
ImageAlphaBlending( $dst_img, TRUE );
[/php]

Read Documentation ·

wpsc_preview_image_cropping_method

Located in: misc.functions.php

Functions that call this hook: nzshpcrt_display_preview_image()
Arguments Accepted: 'cropping'
Version Introduced: 3.8.9

Description: Specify which scaling method to use (cropping or non-cropping).

Code in context:
[php firstline="377" highlight="378"]
// select our scaling method
$scaling_method = apply_filters( ‘wpsc_preview_image_cropping_method’, ‘cropping’ );

// set both offsets to zero
$offset_x = $offset_y = 0;

// Here are the scaling methods, non-cropping causes black lines in tall images, but doesnt crop images.
switch ( $scaling_method ) {
case ‘cropping’:
// if the image is wider than it is high and at least as wide as the target width.
if ( ($source_h <= $source_w ) ) {
if ( $height < $width ) {
$temp_h = ($width / $source_w) * $source_h;
} else {
$temp_w = ($height / $source_h) * $source_w;
}
} else {
$temp_h = ($width / $source_w) * $source_h;
}
break;

case ‘non-cropping’:
default:
if ( $height < $width ) {
$temp_h = ($width / $source_w) * $source_h;
} else {
$temp_w = ($height / $source_h) * $source_w;
}
break;
}
[/php]

Read Documentation ·

wpsc_google_analytics_site_name

Located in: google-analytics.class.php

Functions that call this hook: get_site_name()
Arguments Accepted: $site_name
Version Introduced: 3.8.9

Description: Filter the domain name of the site to use with Google Analytics.

Code in context:
[php firstline="95" highlight="99"]
public function get_site_name() {

$site_name = $this->sanitize( get_bloginfo( ‘name’ ) );

return apply_filters( ‘wpsc_google_analytics_site_name’, $site_name );
}
[/php]

Read Documentation ·

wpsc_google_analytics_domain_name

Located in: google-analytics.class.php

Functions that call this hook: get_domain_name()
Arguments Accepted: $site_url
Version Introduced: 3.8.9

Description: Filter the domain name of the site to use with Google Analytics.

Code in context:
[php firstline="88" highlight="92"]
public function get_domain_name() {

$site_url = $this->sanitize( str_replace( array( ‘https://www.’, ‘http://www.’, ‘https://’, ‘http://’, ), ”, untrailingslashit( network_home_url() ) ) );

return apply_filters( ‘wpsc_google_analytics_domain_name’, $site_url );
}
[/php]

Read Documentation ·

wpsc_coupon_select_item_field

Located in: coupons.class.php

Functions that call this hook: calculate_discount_conditions()
Arguments Accepted: 'unit_price'
Version Introduced: 3.8.9

Description: If “Apply on all products” is not checked and the coupon is percentage, the discount amount should be based on the eligible cart item with lowest unit price. Use this filter to change which field the discounted percentage should be based on.

Code in context:
[php firstline="415" highlight="418"]
// if "Apply on all products" is not checked and the coupon is percentage, the discount
// amount should be based on the eligible cart item with lowest unit price
if ( $this->is_percentage() ) {
$field = apply_filters( ‘wpsc_coupon_select_item_field’ , ‘unit_price’ );
$item = array_shift( $items );
return $item->$field * $this->value / 100;
}
[/php]

Read Documentation ·

wpsc_coupon_select_item_order

Located in: coupons.class.php

Functions that call this hook: get_eligible_items()
Arguments Accepted: 'ASC'
Version Introduced: 3.8.9

Description: Determine how to order cart items before determining which cart items are eligible.

Code in context:
[php firstline="336" highlight="338"]
// sort the items by total price so that we can use this in $this->calculate_discount_conditions()
$orderby = apply_filters( ‘wpsc_coupon_select_item_orderby’, ‘unit_price’ );
$order = apply_filters( ‘wpsc_coupon_select_item_order’ , ‘ASC’ );
$cart_items = $wpsc_cart->get_items( array( ‘orderby’ => $orderby, ‘order’ => $order ) );

$cart_items = array_filter( $cart_items, array( $this, ‘_filter_cart_item_conditions’ ) );

return $cart_items;
[/php]

Read Documentation ·

wpsc_coupon_select_item_orderby

Located in: coupons.class.php

Functions that call this hook: get_eligible_items()
Arguments Accepted: 'unit_price'
Version Introduced: 3.8.9

Description: Determine how to order cart items before determining which cart items are eligible.

Code in context:
[php firstline="336" highlight="337"]
// sort the items by total price so that we can use this in $this->calculate_discount_conditions()
$orderby = apply_filters( ‘wpsc_coupon_select_item_orderby’, ‘unit_price’ );
$order = apply_filters( ‘wpsc_coupon_select_item_order’ , ‘ASC’ );
$cart_items = $wpsc_cart->get_items( array( ‘orderby’ => $orderby, ‘order’ => $order ) );

$cart_items = array_filter( $cart_items, array( $this, ‘_filter_cart_item_conditions’ ) );

return $cart_items;
[/php]

Read Documentation ·

wpsc_checkout_form_gateway_data

Located in: checkout-form-data.class.php

Functions that call this hook: WPSC_Checkout_Form_Data::get_gateway_data()
Arguments Accepted: $gateway_data, $purchase_log_id
Version Introduced: 3.8.9

Description: Use this filter to modify the returned gateway data.

Code in context:
[php firstline="51" highlight="84"]
public function get_gateway_data() {
if ( ! $this->gateway_data = wp_cache_get( $this->log_id, ‘wpsc_checkout_form_gateway_data’ ) ) {
$map = array(
‘firstname’ => ‘first_name’,
‘lastname’ => ‘last_name’,
‘address’ => ‘street’,
‘city’ => ‘city’,
‘state’ => ‘state’,
‘country’ => ‘country’,
‘postcode’ => ‘zip’,
‘phone’ => ‘phone’,
);

foreach( array( ‘shipping’, ‘billing’ ) as $type ) {
$data_key = "{$type}_address";
$this->gateway_data[$data_key] = array();
foreach( $map as $key => $new_key ) {
$key = $type . $key;
if ( isset( $this->data[$key] ) ) {
$value = $this->data[$key];

if ( $new_key == ‘state’ && is_numeric( $value ) )
$value = wpsc_get_state_by_id( $value, ‘code’ );

$this->gateway_data[$data_key][$new_key] = $value;
}
}
$this->gateway_data[$data_key]['name'] = $this->gateway_data[$data_key]['first_name'] + ‘ ‘ + $this->gateway_data[$data_key]['last_name'];
}

wp_cache_set( $this->log_id, $this->gateway_data, ‘wpsc_checkout_form_gateway_data’ );
}

return apply_filters( ‘wpsc_checkout_form_gateway_data’, $this->gateway_data, $this->log_id );
}
[/php]

Read Documentation ·

wpsc_checkout_form_get_data

Located in: checkout-form-data.class.php

Functions that call this hook: WPSC_Checkout_Form_Data::get_data()
Arguments Accepted: $data, $purchase_log_id
Version Introduced: 3.8.9

Description: Use this filter to modify the submitted form data.

Code in context:
[php firstline="47" highlight="48"]
public function get_data() {
return apply_filters( ‘wpsc_checkout_form_get_data’, $this->data, $this->log_id );
}
[/php]

Read Documentation ·

wpsc_checkout_form_data_get_property

Located in: checkout-form-data.class.php

Functions that call this hook: WPSC_Checkout_Form_Data::get()
Arguments Accepted: $value, $key, $this
Version Introduced: 3.8.9

Description: Use this filter to modify the return value of a submitted form field.

Code in context:
[php firstline="42" highlight="44"]
public function get( $key ) {
$value = isset( $this->data[$key] ) ? $this->data[$key] : null;
return apply_filters( ‘wpsc_checkout_form_data_get_property’, $value, $key, $this );
}
[/php]

Read Documentation ·