Frontend_Scripts implements Registerable, Conditional, Premium_Service
Loads the various scripts and styles needed for the cart modal
Tags
Interfaces, Classes and Traits
- Registerable
- Conditional
- Premium_Service
Table of Contents
- SCRIPT_HANDLE = 'wc-fast-cart'
- $settings : mixed
- $version : mixed
- __construct() : mixed
- Constructor.
- add_body_classes() : array<string|int, mixed>
- Adds wfc classes to WordPress body_classes function
- css_vars() : void
- Adds css vars with WFC styles to page body
- default_strings() : array<string|int, mixed>
- Defines in-cart and in-checkout scripts for localization
- is_required() : bool
- Tests to see if templates need to be loaded at all
- load_scripts() : void
- Conditionally loads cart and checkout front-end assets.
- maybe_disable_default_add_to_cart() : bool
- DEPRECATED. determines if default cart scripts should be disabled.
- register() : void
- Hooks actions and filters to enqueue front-end assets.
- register_head() : void
- Registers actions and filters to load front-end assets
- register_scripts() : void
- Registers front-end assets
- enqueue_cart_scripts() : void
- Enqueue cart JavaScript
- enqueue_cart_styles() : void
- Enqueue cart stylesheet
- enqueue_checkout_scripts() : void
- Enqueue checkout JavaScript
- enqueue_checkout_styles() : void
- Enqueue checkout stylesheet
- should_load_cart_scripts() : bool
- Determines if WFC cart scripts should be loaded on the page
- should_load_checkout_scripts() : bool
- Determines if WFC checkout scripts should be loaded on the page
Constants
SCRIPT_HANDLE
public
mixed
SCRIPT_HANDLE
= 'wc-fast-cart'
Tags
Properties
$settings
private
mixed
$settings
Tags
$version
private
mixed
$version
Tags
Methods
__construct()
Constructor.
public
__construct(string $version) : mixed
Parameters
- $version : string
-
Plugin version
Tags
Return values
mixed —add_body_classes()
Adds wfc classes to WordPress body_classes function
public
add_body_classes(array<string|int, mixed> $classes) : array<string|int, mixed>
Parameters
- $classes : array<string|int, mixed>
-
existing body classes
Tags
Return values
array<string|int, mixed> —new classes
css_vars()
Adds css vars with WFC styles to page body
public
css_vars() : void
Tags
Return values
void —default_strings()
Defines in-cart and in-checkout scripts for localization
public
default_strings(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
wfc cart params localization data
Tags
Return values
array<string|int, mixed> —existing data with strings added
is_required()
Tests to see if templates need to be loaded at all
public
is_required() : bool
Tags
Return values
bool —load_scripts()
Conditionally loads cart and checkout front-end assets.
public
load_scripts() : void
Tags
Return values
void —maybe_disable_default_add_to_cart()
DEPRECATED. determines if default cart scripts should be disabled.
public
maybe_disable_default_add_to_cart(bool $value) : bool
Parameters
- $value : bool
-
existing status of cart scripts
Tags
Return values
bool —new status
register()
Hooks actions and filters to enqueue front-end assets.
public
register() : void
Tags
Return values
void —register_head()
Registers actions and filters to load front-end assets
public
register_head() : void
Tags
Return values
void —register_scripts()
Registers front-end assets
public
register_scripts() : void
Tags
Return values
void —enqueue_cart_scripts()
Enqueue cart JavaScript
private
enqueue_cart_scripts() : void
Tags
Return values
void —enqueue_cart_styles()
Enqueue cart stylesheet
private
enqueue_cart_styles() : void
Tags
Return values
void —enqueue_checkout_scripts()
Enqueue checkout JavaScript
private
enqueue_checkout_scripts() : void
Tags
Return values
void —enqueue_checkout_styles()
Enqueue checkout stylesheet
private
enqueue_checkout_styles() : void
Tags
Return values
void —should_load_cart_scripts()
Determines if WFC cart scripts should be loaded on the page
private
should_load_cart_scripts() : bool
Tags
Return values
bool —should_load_checkout_scripts()
Determines if WFC checkout scripts should be loaded on the page
private
should_load_checkout_scripts() : bool