PHP Интерфейс WC_Product_Data_Store_Interface

Functions that must be defined by product store classes.
Автор: WooThemes
Показать файл Открыть проект

Открытые методы

Метод Описание
find_matching_product_variation ( WC_Product $product, array $match_attributes = [] ) : integer Find a matching (enabled) variation within a variable product.
get_ending_sales ( ) : array Returns an array of IDs of products that have sales which are due to end.
get_featured_product_ids ( ) : array Returns a list of product IDs ( id as key => parent as value) that are featured. Uses get_posts instead of wc_get_products since we want some extra meta queries and ALL products (posts_per_page = -1).
get_on_sale_products ( ) : array Returns an array of on sale products, as an array of objects with an ID and parent_id present. Example: $return[0]->id, $return[0]->parent_id.
get_product_id_by_sku ( string $sku ) : integer Return product ID based on SKU.
get_products ( array $args = [] ) : array Returns an array of products.
get_related_products ( array $cats_array, array $tags_array, array $exclude_ids, integer $limit, integer $product_id ) : array Return a list of related products (using data like categories and IDs).
get_shipping_class_id_by_slug ( $slug ) : integer | false Get shipping class ID by slug.
get_starting_sales ( ) : array Returns an array of IDs of products that have sales starting soon.
is_existing_sku ( integer $product_id, string $sku ) : boolean Check if product sku is found for any other product IDs.
update_product_stock ( $product_id_with_stock, integer | null $stock_quantity = null, string $operation = 'set' ) Update a product's stock amount directly.

Описание методов

find_matching_product_variation() публичный Метод

Find a matching (enabled) variation within a variable product.
public find_matching_product_variation ( WC_Product $product, array $match_attributes = [] ) : integer
$product WC_Product Variable product.
$match_attributes array Array of attributes we want to try to match.
Результат integer Matching variation ID or 0.

get_ending_sales() публичный Метод

Returns an array of IDs of products that have sales which are due to end.
public get_ending_sales ( ) : array
Результат array

get_on_sale_products() публичный Метод

Returns an array of on sale products, as an array of objects with an ID and parent_id present. Example: $return[0]->id, $return[0]->parent_id.
public get_on_sale_products ( ) : array
Результат array

get_product_id_by_sku() публичный Метод

Return product ID based on SKU.
public get_product_id_by_sku ( string $sku ) : integer
$sku string
Результат integer

get_products() публичный Метод

Returns an array of products.
public get_products ( array $args = [] ) : array
$args array @see wc_get_products
Результат array

get_shipping_class_id_by_slug() публичный Метод

Get shipping class ID by slug.
public get_shipping_class_id_by_slug ( $slug ) : integer | false
$slug string
Результат integer | false

get_starting_sales() публичный Метод

Returns an array of IDs of products that have sales starting soon.
public get_starting_sales ( ) : array
Результат array

is_existing_sku() публичный Метод

Check if product sku is found for any other product IDs.
public is_existing_sku ( integer $product_id, string $sku ) : boolean
$product_id integer
$sku string
Результат boolean

update_product_stock() публичный Метод

Uses queries rather than update_post_meta so we can do this in one query (to avoid stock issues).
public update_product_stock ( $product_id_with_stock, integer | null $stock_quantity = null, string $operation = 'set' )
$stock_quantity integer | null
$operation string set, increase and decrease.