Item_Data implements Registerable, Service
This class handles carrying the lead time on the cart and order item data
Tags
Interfaces, Classes and Traits
- Registerable
- An object that can be registered with WordPress via the Plugin API, i.e. add_action() and add_filter().
- Service
- Marker interface to denote a service.
Table of Contents
- add_cart_item_data() : array<string|int, mixed>
- Add lead time data to cart item.
- add_order_item_data() : mixed
- Add lead time data to order item
- display_cart_item_data() : array<string|int, mixed>
- Display lead time data in the cart.
- manual_add_order_item_data() : void
- Generate lead time metadata when manually creating an order.
- register() : void
- Register hooks and filters.
- format_item_meta() : array<string|int, mixed>
- Handles seperators ( :, - ) and formats item meta for better display in WC
Methods
add_cart_item_data()
Add lead time data to cart item.
public
add_cart_item_data(array<string|int, mixed> $cart_item_data, int $product_id, int $variation_id) : array<string|int, mixed>
Parameters
- $cart_item_data : array<string|int, mixed>
- $product_id : int
- $variation_id : int
Return values
array<string|int, mixed> —add_order_item_data()
Add lead time data to order item
public
add_order_item_data(WC_Order_Item_Product $item, string $cart_item_key, array<string|int, mixed> $values, WC_Order $order) : mixed
Parameters
- $item : WC_Order_Item_Product
- $cart_item_key : string
- $values : array<string|int, mixed>
- $order : WC_Order
Return values
mixed —display_cart_item_data()
Display lead time data in the cart.
public
display_cart_item_data(array<string|int, mixed> $item_data, array<string|int, mixed> $cart_item) : array<string|int, mixed>
Parameters
- $item_data : array<string|int, mixed>
- $cart_item : array<string|int, mixed>
Return values
array<string|int, mixed> —manual_add_order_item_data()
Generate lead time metadata when manually creating an order.
public
manual_add_order_item_data(WC_Order_Item_Product $item) : void
Parameters
- $item : WC_Order_Item_Product
Return values
void —register()
Register hooks and filters.
public
register() : void
Return values
void —format_item_meta()
Handles seperators ( :, - ) and formats item meta for better display in WC
private
format_item_meta(string $lead_time[, object $product = false ][, bool $skip_prefix = false ]) : array<string|int, mixed>
Parameters
- $lead_time : string
- $product : object = false
- $skip_prefix : bool = false