Quantity_Field implements Service, Registerable, Conditional
Handles the display of the Quantity field on shop and category pages.
Tags
Interfaces, Classes and Traits
- Service
- Registerable
- Conditional
Table of Contents
- $settings : mixed
- __construct() : mixed
- Constructor - set the plugin settings
- add_category_page_quantity_field_hooks() : mixed
- Add quantity fields to the product category page
- add_products_class() : array<string|int, mixed>
- Add class to the product posts loop in shop and category pages
- add_shop_page_quantity_field_hooks() : mixed
- Add quantity fields to the shop page
- category_page_quantity_field_enabled() : bool
- Check if quantity field is enabled on category page
- is_required() : bool
- Check if it's required to load
- products_loop_class_hooks() : mixed
- Add hook to the products look class hook
- register() : mixed
- Register necessary hooks
- shop_page_quantity_field_enabled() : bool
- Check if quantity field is enabled on shop page
- should_display_quantity_field() : mixed
- Determine if we should display quantity field for specific product
- show_quantity_field() : mixed
- Display quantity fields to respective locations
Properties
$settings
private
mixed
$settings
Methods
__construct()
Constructor - set the plugin settings
public
__construct(object $plugin) : mixed
Parameters
- $plugin : object
-
The main plugin object
Return values
mixed —add_category_page_quantity_field_hooks()
Add quantity fields to the product category page
public
add_category_page_quantity_field_hooks() : mixed
Return values
mixed —add_products_class()
Add class to the product posts loop in shop and category pages
public
add_products_class(array<string|int, mixed> $classes, string $class, int $product_id) : array<string|int, mixed>
Parameters
- $classes : array<string|int, mixed>
- $class : string
- $product_id : int
Return values
array<string|int, mixed> —$classes
add_shop_page_quantity_field_hooks()
Add quantity fields to the shop page
public
add_shop_page_quantity_field_hooks() : mixed
Return values
mixed —category_page_quantity_field_enabled()
Check if quantity field is enabled on category page
public
category_page_quantity_field_enabled() : bool
Return values
bool —is_required()
Check if it's required to load
public
is_required() : bool
Return values
bool —products_loop_class_hooks()
Add hook to the products look class hook
public
products_loop_class_hooks() : mixed
Return values
mixed —register()
Register necessary hooks
public
register() : mixed
Return values
mixed —shop_page_quantity_field_enabled()
Check if quantity field is enabled on shop page
public
shop_page_quantity_field_enabled() : bool
Return values
bool —should_display_quantity_field()
Determine if we should display quantity field for specific product
public
should_display_quantity_field(object $product) : mixed
Parameters
- $product : object
Return values
mixed —show_quantity_field()
Display quantity fields to respective locations
public
show_quantity_field() : mixed