Product Functions
get_products()
/**
* Retrieve all the products regardless of status.
*
* @return array
* @throws ReflectionException
* @throws UnresolvableQueryHandlerException
*/
function get_products(): array;
get_all_products_with_filters()
/**
* Retrieve all products or a product based on filters.
*
* @file App/Shared/Helpers/product.php
* @param string|null $productSku Product sku.
* @param int $limit Number of products to show.
* @param int|null $offset The offset of the first row to be returned.
* @param string $status Returned unescaped product based on status (all, draft, published, pending, archived)
* @return array Array of published products or product by particular sku.
* @throws CommandPropertyNotFoundException
* @throws ReflectionException
* @throws UnresolvableQueryHandlerException
*/
function get_all_products_with_filters(
?string $productSku = null,
int $limit = 0,
int $offset = null,
string $status = 'all'
): array;
get_product_by()
/**
* Retrieve product by a given field from the product table.
*
* @file App/Shared/Helpers/product.php
* @param string $field The field to retrieve the product with
* (id = product_id, sku = product_sku, slug = product_slug).
* @param string $value A value for $field (product_id, product_sku, product_slug).
* @return false|object
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_by(string $field, string $value): false|object;
get_product_by_id()
/**
* Retrieve product by the product id.
*
* @file App/Shared/Helpers/product.php
* @param string $productId
* @return false|object
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_by_id(string $productId): object|false;
get_product_datetime()
/**
* A function which retrieves product datetime.
*
* Purpose of this function is for the `product_datetime`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string|null $product
* @return string Product datetime.
* @throws ReflectionException
* @throws Exception
*/
function get_product_datetime(?string $product = null): string;
get_product_modified()
/**
* A function which retrieves product modified datetime.
*
* Purpose of this function is for the `product_modified`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @return string Product modified datetime or '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_modified(string $productId): string;
get_product_body()
/**
* A function which retrieves a product body.
*
* Purpose of this function is for the `product_body`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @return string Product body or '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_body(string $productId): string;
get_product_sku()
/**
* A function which retrieves a product product_type name.
*
* Purpose of this function is for the `product_sku`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @return string|false Product type name or '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_sku(string $productId): false|string;
get_product_title()
/**
* A function which retrieves a product title.
*
* Purpose of this function is for the `product_title`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @return string Product title or '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_title(string $productId): string;
get_product_slug()
/**
* A function which retrieves a product slug.
*
* Purpose of this function is for the `product_slug`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @return string Product slug or ''.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_slug(string $productId): string;
/**
* Retrieve product meta field for a product.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product ID.
* @param string $key Optional. The meta key to retrieve.
* @param bool $single Optional. Whether to return a single value. Default false.
* @return mixed Will be an array if $single is false. Will be value of metadata
* field if $single is true.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_productmeta(string $productId, string $key = '', bool $single = false): mixed;
/**
* Get product metadata by meta ID.
*
* @file App/Shared/Helpers/product.php
* @param string $mid
* @return array|bool
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_productmeta_by_mid(string $mid): bool|array;
/**
* Update product meta field based on product ID.
*
* Use the $prevValue parameter to differentiate between meta fields with the
* same key and product ID.
*
* If the meta field for the product does not exist, it will be added.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product ID.
* @param string $metaKey Metadata key.
* @param mixed $metaValue Metadata value. Must be serializable if non-scalar.
* @param mixed $prevValue Optional. Previous value to check before removing.
* Default empty.
* @return bool|string Meta ID if the key didn't exist, true on successful update,
* false on failure.
* @throws CommandPropertyNotFoundException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableQueryHandlerException
*/
function update_productmeta(
string $productId,
string $metaKey,
mixed $metaValue,
mixed $prevValue = ''
): bool|string;
/**
* Update product metadata by meta ID.
*
* @file App/Shared/Helpers/product.php
* @param string $mid
* @param string $metaKey
* @param string $metaValue
* @return bool
* @throws CommandPropertyNotFoundException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableQueryHandlerException
*/
function update_productmeta_by_mid(string $mid, string $metaKey, string $metaValue): bool;
/**
* Add metadata field to a product.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product ID.
* @param string $metaKey Metadata name.
* @param mixed $metaValue Metadata value. Must be serializable if non-scalar.
* @param bool $unique Optional. Whether the same key should not be added.
* Default false.
* @return false|string Meta ID on success, false on failure.
* @throws CommandPropertyNotFoundException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableQueryHandlerException
*/
function add_productmeta(string $productId, string $metaKey, mixed $metaValue, bool $unique = false): false|string;
/**
* Remove metadata matching criteria from a product.
*
* You can match based on the key, or key and value. Removing based on key and
* value, will keep from removing duplicate metadata with the same key. It also
* allows removing all metadata matching key, if needed.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product ID.
* @param string $metaKey Metadata name.
* @param mixed $metaValue Optional. Metadata value. Must be serializable if
* non-scalar. Default empty.
* @return bool True on success, false on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function delete_productmeta(string $productId, string $metaKey, mixed $metaValue = ''): bool;
/**
* Delete product meta data by meta ID.
*
* @file App/Shared/Helpers/product.php
* @param string $mid
* @return bool
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function delete_productmeta_by_mid(string $mid): bool;
get_product_custom()
/**
* Retrieve product meta fields, based on product ID.
*
* The product meta fields are retrieved from the cache where possible,
* so the function is optimized to be called more than once.
*
* @file App/Shared/Helpers/product.php
* @param string $productId The product's id.
* @return mixed Product meta for the given product.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_custom(string $productId): mixed;
get_product_custom_keys()
/**
* Retrieve meta field names for a product.
*
* If there are no meta fields, then nothing (null) will be returned.
*
* @file App/Shared/Helpers/product.php
* @param string $productId The product's id.
* @return array Array of the keys, if retrieved.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_custom_keys(string $productId): array;
get_product_custom_values()
/**
* Retrieve values for a custom product field.
*
* The parameters must not be considered optional. All the product meta fields
* will be retrieved and only the meta field key values returned.
*
* @file App/Shared/Helpers/product.php
* @param string $productId The product's id.
* @param string $key Meta field key.
* @return array Meta field values or [].
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_custom_values(string $productId, string $key): array;
get_product_author_id()
/**
* A function which retrieves a product author id.
*
* Purpose of this function is for the `product_author_id`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @return false|string Product author id or false on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_author_id(string $productId): false|string;
get_product_author()
/**
* A function which retrieves a product author.
*
* Purpose of this function is for the `product_author`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Optional Product id or product object.
* @param bool $reverse If first name should appear first or not. Default is false.
* @return string|false Product author or false on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_author(string $productId, bool $reverse = false): false|string;
get_product_status()
/**
* A function which retrieves a product status.
*
* Purpose of this function is for the `product_status`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @return string|false Product status or false on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_status(string $productId): false|string;
get_product_date()
/**
* A function which retrieves product date.
*
* Uses `call_user_func_array()` function to return appropriate product date function.
* Dynamic part is the variable $type, which calls the date function you need.
*
* @file App/Shared/Helpers/product.php
* @param string $type Type of date to return: created, published, modified. Default: published.
* @param string $productId Product id.
* @return string Product date.
*/
function get_product_date(string $type = 'published', string $productId = ''): string;
get_product_time()
/**
* A function which retrieves product time.
*
* Uses `call_user_func_array()` function to return appropriate product time function.
* Dynamic part is the variable $type, which calls the date function you need.
*
* @file App/Shared/Helpers/product.php
* @param string $type Type of date to return: created, published, modified. Default: published.
* @param string $productId Product id.
* @return string Product time.
*/
function get_product_time(string $type = 'published', string $productId = ''): string;
get_product_created_date()
/**
* Retrieves product created date.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the date the product was created.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted product created date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_created_date(
string $productId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_product_created_date()
/**
* Retrieves product created date.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the date the product was created.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default empty.
* @return string Formatted product created date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_product_created_date(string $productId, string $format = ''): string;
get_product_created_time()
/**
* A function which retrieves product created time.
*
* Purpose of this function is for the `product_created_time`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the time the product was created.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted product created time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_created_time(
string $productId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_product_created_time()
/**
* Retrieves product created time.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the time the product was written.
* Accepts 'G', 'U', or php date format value specified
* in 'time_format' option. Default empty.
* @return string Formatted product created time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_product_created_time(string $productId, string $format = ''): string;
get_product_published_date()
/**
* A function which retrieves product published date.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the date the product was published.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted product published date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_published_date(
string $productId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_product_published_date()
/**
* Retrieves product published date.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the date the product was published.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default empty.
* @return string Formatted product published date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_product_published_date(string $productId, string $format = ''): string;
get_product_published_time()
/**
* A function which retrieves product published time.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the time the product was published.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted product published time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_published_time(
string $productId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_product_published_time()
/**
* Retrieves product published time.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the time the product was published.
* Accepts 'G', 'U', or php date format value specified
* in 'time_format' option. Default empty.
* @return string Formatted product published time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_product_published_time(string $productId, string $format = ''): string;
get_product_modified_date()
/**
* A function which retrieves product modified date.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the date the product was modified.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted product modified date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_modified_date(
string $productId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_product_modified_date()
/**
* Retrieves product published date.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the date the product was published.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default empty.
* @return string Formatted product modified date string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_product_modified_date(string $productId, string $format = ''): string;
get_product_modified_time()
/**
* A function which retrieves product modified time.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the time the product was modified.
* Accepts 'G', 'U', or php date format value specified
* in 'date_format' option. Default 'U'.
* @param bool $gmt Whether to use GMT. Default false.
* @param bool $translate Whether the returned string should be translated. Default false.
* @return string Formatted product modified time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_modified_time(
string $productId,
string $format = 'U',
bool $gmt = false,
bool $translate = false
): string;
the_product_modified_time()
/**
* Retrieves product modified time.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @param string $format Format to use for retrieving the time the product was modified.
* Accepts 'G', 'U', or php date format value specified
* in 'time_format' option. Default empty.
* @return string Formatted product modified time string or Unix timestamp
* if $format is 'U' or 'G'. '' on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_product_modified_time(string $productId, string $format = ''): string;
/**
* A function which retrieves product show in menu.
*
* Purpose of this function is for the `product_show_in_menu`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @return int Product show in menu integer or 0 on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_show_in_menu(string $productId): int;
get_product_show_in_search()
/**
* A function which retrieves product show in search.
*
* Purpose of this function is for the `product_show_in_search`
* filter.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id.
* @return int Product show in search integer or 0 on failure.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_show_in_search(string $productId): int;
cms_unique_product_slug()
/**
* Creates a unique product slug.
*
* @file App/Shared/Helpers/product.php
* @param string $originalSlug Original slug of product.
* @param string $originalTitle Original title of product.
* @param string|null $productId Unique product id or null.
* @return string Unique product slug.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function cms_unique_product_slug(
string $originalSlug,
string $originalTitle,
?string $productId = null,
): string;
cms_insert_product()
/**
* Insert or update a product.
*
* All the `$productdata` array fields have filters associated with the values. The filters
* have the prefix 'pre_' followed by the field name. An example using 'product_status' would have
* the filter called, 'pre_product_status' that can be hooked into.
*
* @file App/Shared/Helpers/product.php
* @param array|ServerRequestInterface|Product $productdata An array of data that is used for insert or update.
*
* @type string $productTitle The product's title.
* @type string $productBody The product's body.
* @type string $productSlug The product's slug.
* @type string $productAuthor The product's author.
* @type string $productSku The product's parent.
* @type string $productPrice The product's price.
* @type string $productCurrency The product's currency.
* @type string $productPurchaseUrl The product's purchase url.
* @type string $productShowInMenu Whether to show product in menu.
* @type string $productShowInSearch Whether to show product in search.
* @type string $productRelativeUrl The product's relative url.
* @type string $productFeaturedImage THe product's featured image.
* @type string $productStatus THe product's status.
* @type string $productPublished Timestamp describing the moment when the product
* was published. Defaults to Y-m-d h:i A.
* @return Error|string|null The newly created product's product_id or throws an error or returns null
* if the product could not be created or updated.
* @throws CommandCouldNotBeHandledException
* @throws CommandPropertyNotFoundException
* @throws Exception
* @throws InvalidArgumentException
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableCommandHandlerException
* @throws UnresolvableQueryHandlerException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
function cms_insert_product(array|ServerRequestInterface|Product $productdata): Error|string|null;
cms_update_product()
/**
* Update a product in the product document.
*
* See {@see cms_insert_product()} For what fields can be set in $productdata.
*
* @file App/Shared/Helpers/product.php
* @param array|ServerRequestInterface|Product $productdata An array of product data or a product object.
* @return string|Error The updated product's id or return Error if product could not be updated.
* @throws CommandCouldNotBeHandledException
* @throws CommandPropertyNotFoundException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableCommandHandlerException
* @throws UnresolvableQueryHandlerException
*/
function cms_update_product(array|ServerRequestInterface|Product $productdata): string|Error;
cms_delete_product()
/**
* Deletes product from the product document.
*
* @file App/Shared/Helpers/product.php
* @param string $productId The id of the product to delete.
* @return bool|Product Product on success or false on failure.
* @throws CommandCouldNotBeHandledException
* @throws CommandPropertyNotFoundException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableCommandHandlerException
*/
function cms_delete_product(string $productId): Product|bool;
get_product_class()
/**
* Retrieves an array of css class names.
*
* @file App/Shared/Helpers/product.php
* @param string $productId Product id of current product.
* @param string|array $class One or more css class names to add to element list.
* @return array An array of css class names.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function get_product_class(string $productId, string|array $class = ''): array;
/**
* Retrieves and displays product meta value.
*
* Uses `the_product_meta` filter.
*
* @file App/Shared/Helpers/product.php
* @param string|Product|ProductId $product Product object or id.
* @param string $key Product meta key.
* @return string Product meta value.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function the_product_meta(string|Product|ProductId $product, string $key): string;
currency_option()
/**
* Currency dropdown options.
*
* @param string|null $active Currency selected.
* @return void
*/
function currency_option(?string $active = null): void;