PHP 인터페이스 WC_Product_Data_Store_Interface

Functions that must be defined by product store classes.
저자: WooThemes
파일 보기 프로젝트 열기: woocommerce/woocommerce

공개 메소드들

메소드 설명
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.