Actions and Filters
WooCommerce Fast Cart comes with a number of action and filter hooks which allow you to customize the plugin's behavior.
Please note that code snippets are aimed at developers. If you feel comfortable using them, our article on how to use code snippets can serve as a helpful guide. However, if you don't feel comfortable using them, then you should ask your developer. If you don't have one then you can use our plugin customization service.
Actions
wfc_cart_coupon
Replacement for woocommerce_cart_coupon
Fast Cart tries to implement standard WooCommerce templates wherever possible, but in some cases this creates unintended conflicts with plugins that try to integrate with WooCommerce. This hook is in the place of woocommerce_cart_coupon, and implements all of its standard functions.
Example
add_action( 'wfc_cart_coupon', 'my_wfc_cart_coupon' );
function my_wfc_cart_coupon() {
// your code here...
}
wfc_load_cart_scripts
Fired after all Fast Cart cart scripts have been enqueued.
Executed within the wp_enqueue_scripts action. Not executed if cart-related scripts have not been loaded (for instance, on the default WC cart page, ironically.)
Example
add_action( 'wfc_load_cart_scripts', 'my_wfc_load_cart_scripts' );
function my_wfc_load
_cart_scripts() { // your code here... }
wfc_load_checkout_scripts
Fired after all Fast Cart checkout scripts have been enqueued.
Executed within the wp_enqueue_scripts action. Not executed if checkout-related scripts have not been loaded, usually this will only be fired from within the Fast Cart checkout iframe.
Example
add_action( 'wfc_load_checkout_scripts', 'my_wfc_load_checkout_scripts' );
function my_wfc_load_checkout_scripts() {
// your code here...
}
wfc_load_scripts
Fired after all Fast Cart page-specific scripts have been enqueued.
Executed within the wp_enqueue_scripts action.
Example
add_action( 'wfc_load_scripts', 'my_wfc_load_scripts' );
function my_wfc_load_scripts() {
// your code here...
}
wfc_register_scripts
Fired after all Fast Cart global scripts have been registered.
Executed within the wp_enqueue_scripts action.
Example
add_action( 'wfc_register_scripts', 'my_wfc_register_scripts' );
function my_wfc_register_scripts() {
// your code here...
}
wfc_before_cart_totals
Fires before showing the cart totals in the fast cart template.
Example
add_action( 'wfc_before_cart_totals', 'my_wfc_before_cart_totals' );
function my_wfc_before_cart_totals() {
// your code here...
}
wfc_cart_totals_before_shipping
Fires before showing the shipping information in the fast cart template.
wfc_cart_totals_after_shipping
Fires after showing the shipping information on the fast cart template.
Example
add_action( 'wfc_cart_totals_before_shipping', 'my_wfc_after_shpping' ); function my_wfc_after_shpping() { // write your code here }
wfc_before_cart
Fire before showing the cart form.
wfc_after_cart
Fires after showing the cart form.
Example:
add_action( 'wfc_after_cart', 'my_wfc_after_cart' );
function my_wfc_after_cart() {
// write your code here
}
wfc_before_cart_table
Fires before showing the items table in the cart form.
wfc_after_cart_table
Fires after showing the items table in the cart form.
Example:
add_action( 'wfc_after_cart_table', 'my_wfc_after_cart_table' );
function my_wfc_after_cart_table() {
// write your code here
}
wfc_before_proceed_to_checkout_buttons
Fires before showing the "Checkout" and "Keep Shopping" buttons in the cart template.
wfc_after_proceed_to_checkout_buttons
Fires after showing the "Checkout" and "Keep Shopping" buttons in the cart template.
Example:
add_action( 'wfc_after_proceed_to_checkout_buttons', 'my_wfc_after_buttons' );
function my_wfc_after_buttons() {
// write your code here
}
wfc_checkout_before_content
Fires before showing the fast checkout content.
wfc_checkout_after_content
Fires after showing the fast checkout content.
add_action( 'wfc_checkout_after_content', 'my_wfc_after_checkout' );
function my_wfc_after_checkout() {
// write your code here
}
Filters
wfc_checkout_script_params
Properties assigned to a global-scope variable containing Fast Cart checkout page settings.
Use this to change Fast Cart behavior before it is provided to the Fast Cart checkout scripts.
Arguments
$script_data
(array): Array of Fast Cart parameters.
Example
add_filter( 'wfc_checkout_script_params', 'my_wfc_checkout_script_params' );
function my_wfc_checkout_script_params( $script_data ) {
// your code to alter $script_data here...
return $script_data;
}
wfc_default_button_classes
Classes to add to the default checkout button.
Fast Cart generates a checkout button in the background to determine a color scheme for UI elements in the cart. It looks at background color, text color, and border size. After generation, various buttons, fields, and links will inherit styles determined from a button with these classes assigned.
Arguments
$var
(string): A space-separated list of classes to apply to the button template.
Example
add_filter( 'wfc_default_button_classes', 'my_wfc_default_button_classes' );
function my_wfc_default_button_classes( $var ) {
// your code to alter $var here...
return $var;
}
wfc_enabled_on_checkout
Determines if front-end checkout scripts should be enqueued.
By default checkout-related scripts are only loaded from within the Fast Cart checkout iframe.
Arguments
$var
(bool): Enqueue scripts.
Example
add_filter( 'wfc_enabled_on_checkout', 'my_wfc_enabled_on_checkout' );
function my_wfc_enabled_on_checkout( $var ) {
// your code to alter $var here...
return $var;
}
wfc_enabled_on_page
Determines if front-end cart scripts should be enqueued.
By default cart-related scripts are loaded on all pages.
Arguments
$var
(bool): Enqueue scripts.
Example
add_filter( 'wfc_enabled_on_page', 'my_wfc_enabled_on_page' );
function my_wfc_enabled_on_page( $var ) {
// your code to alter $var here...
return $var;
}
wfc_script_params
Properties assigned to a global-scope variable containing Fast Cart settings.
Use this to change Fast Cart behavior before it is provided to the Fast Cart front-end scripts.
Arguments
$script_data
(array): Array of Fast Cart parameters.
Example
add_filter( 'wfc_script_params', 'my_wfc_script_params' );
function my_wfc_script_params( $script_data ) {
// your code to alter $script_data here...
return $script_data;
}
wfc_settings
Filter Fast Cart setting values.
Provides the ability change user settings before they are used by Fast Cart.
Arguments
$var
(array): Current settings to be returned by function, with default values already assigned.$var
(array): Original user-defined settings found in options table.
Example
add_filter( 'wfc_settings', 'my_wfc_settings', 10, 2 );
function my_wfc_settings( $var, $var ) {
// your code to alter $var here...
return $var;
}
wfc_wrapper_classes
Classes added to the Fast Cart DOM wrapper
By default no additional classes are added, but `wc-fast-cart` will always be added by the front-end JavaScript.
Arguments
$var
(bool): Enqueue scripts.
Example
add_filter( 'wfc_wrapper_classes', 'my_wfc_wrapper_classes' );
function my_wfc_wrapper_classes( $var ) {
// your code to alter $var here...
return $var;
}
wfc_checkout_complete_script_params
Filters JavaScript variables used by Fast Cart during checkout processing.
Arguments
$params
(array): The parameters passed to the checkout JS.$order
WC_Order: The WooCommerce order object being processed.
Example
add_filter( 'wfc_checkout_complete_script_params', 'my_wfc_checkout_params', 10, 2 );
function my_wfc_checkout_params( $params, $order ) {
$params['receiptUrl'] = 'an alternate order receipt location';
return $params;
}