1. WooCommerce Fast Cart
  2. Developer Documentation

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 this code is aimed at developers and if you don't know how to use it then you should ask your developer.

We've partnered with Codeable to provide our customers with expert help if required.

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...
}

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;
}

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.