Action Hooks

New Order Action

To execute your custom code after a Studiocart order has been added using the following action hook:  do_action(‘sc_order_complete’);

Parameters:

$status

String (e.g. ‘paid’, ‘refunded’, etc.)

$order_info

Object

$order_type

String (e.g. ‘main’, ‘bump’, ‘upsell’)

Example:

add_action( ‘sc_order_complete’, ‘custom_sc_order_complete’, 10, 3 );
function custom_sc_order_complete($status,$order_info,$order_type){
// Do your custom stuff here
}

Pending Order Action 

To execute your custom code after a Studiocart pending order has been added using the following action hook:  do_action(‘sc_order_pending’); //For COD orders only

Parameters:

$status

String (e.g. ‘paid’, ‘refunded’, etc.)

$order_info

Object

$order_type

String (e.g. ‘main’, ‘bump’, ‘upsell’)

Example:

add_action( ‘sc_order_pending’, ‘custom_sc_order_pending’, 10, 3 );
function custom_sc_order_pending($status,$order_info,$order_type){
// Do your custom stuff here
}

Subscription Active Action 

To execute your custom code after a Studiocart subscription  has been activated using the following action hook:  do_action(‘sc_subscription_active’); 

Parameters:

$status

String (e.g. ‘paid’, ‘refunded’, etc.)

$order_info

Object

$order_type

String (e.g. ‘main’, ‘bump’, ‘upsell’)

Example:

add_action( ‘sc_subscription_active’, ‘custom_sc_subscription_active’, 10, 3 );
function custom_sc_subscription_active($status,$order_info,$order_type){
// Do your custom stuff here
}

Subscription Cancelled Action 

To execute your custom code after a Studiocart subscription has been cancelled using the following action hook:  do_action(‘sc_subscription_canceled’); 

Parameters:

$status

String (e.g. ‘paid’, ‘refunded’, etc.)

$order_info

Object

$order_type

String (e.g. ‘main’, ‘bump’, ‘upsell’)

Example:

add_action( ‘sc_subscription_canceled’, ‘custom_sc_subscription_canceled’, 10, 3 );
function custom_sc_subscription_canceled($status,$order_info,$order_type){
// Do your custom stuff here
}

Order Lead Action 

To execute your custom code after a Studiocart order lead has been added using the following action hook:  do_action(‘sc_order_lead’); //For capturing leads only

Parameters:

$status

String (e.g. ‘paid’, ‘refunded’, etc.)

$order_info

Object

$order_type

String (e.g. ‘main’, ‘bump’, ‘upsell’)

Example:

add_action( ‘sc_order_lead’, ‘custom_sc_order_lead’, 10, 3 );
function custom_sc_order_lead($status,$order_info,$order_type){
// Do your custom stuff here
}

Subscription Completed Action

To execute your custom code after a Studiocart subscription  has been completed (payment plan reached scheduled end date) using the following action hook:  do_action(‘sc_subscription_completed’); 

Parameters:

$status

String (e.g. ‘paid’, ‘refunded’, etc.)

$order_info

Object

$order_type

String (e.g. ‘main’, ‘bump’, ‘upsell’)

Example:

add_action( ‘sc_subscription_completed’, ‘custom_sc_subscription_completed’, 10, 3 );
function custom_sc_subscription_completed($status,$order_info,$order_type){
// Do your custom stuff here
}

Order Refunded Action

To execute your custom code after a Studiocart  order has been refunded using the following action hook:  do_action(‘sc_order_refunded’); 

Parameters:

$status

String (e.g. ‘paid’, ‘refunded’, etc.)

$order_info

Object

$order_type

String (e.g. ‘main’, ‘bump’, ‘upsell’)

Example:

add_action( ‘sc_order_refunded’, ‘custom_sc_order_refunded’, 10, 3 );
function custom_sc_order_refunded($status,$order_info,$order_type){
// Do your custom stuff here
}