Метод |
Описание |
|
__get ( string $key ) : mixed |
Magic __get method for backwards compatibility. Maps legacy vars to new getters. |
|
__isset ( string $key ) : boolean |
Magic __isset method for backwards compatibility. Legacy properties which could be accessed directly in the past. |
|
adjust_price ( mixed $price ) |
Adjust a products price dynamically. |
|
check_stock_status ( ) |
Check if the stock status needs changing. |
|
enable_dimensions_display ( ) : boolean |
Returns whether or not we are showing dimensions on the product page. |
|
get_availability ( ) : string |
Returns the availability of the product. |
|
get_categories ( string $sep = ', ', string $before = '', string $after = '' ) : string |
Returns the product categories. |
|
get_child ( mixed $child_id ) : WC_Product | WC_Product_variation |
Returns the child product. |
|
get_cross_sells ( ) : array |
Returns the cross sell product ids. |
|
get_display_price ( string $price = '', integer $qty = 1 ) : string |
Returns the price including or excluding tax, based on the 'woocommerce_tax_display_shop' setting. |
|
get_files ( ) : array |
Same as get_downloads in CRUD. |
|
get_formatted_variation_attributes ( $flat = false ) : string |
Get formatted variation data with WC < 2.4 back compat and proper formatting of text-based attribute names. |
|
get_gallery_attachment_ids ( ) : array |
Returns the gallery attachment ids. |
|
get_matching_variation ( $match_attributes = [] ) |
Match a variation to a given set of attributes using a WP_Query. |
|
get_parent ( ) : integer |
Get the parent of the post. |
|
get_post_data ( ) : WP_Post |
Get the product's post data. |
|
get_price_excluding_tax ( integer $qty = 1, string $price = '' ) : string |
Returns the price (excluding tax) - ignores tax_class filters since the price may *include* tax and thus needs subtracting. |
|
get_price_html_from_text ( ) : string |
Functions for getting parts of a price, in html, used by get_price_html. |
|
get_price_html_from_to ( string $from, mixed $to ) : string |
Functions for getting parts of a price, in html, used by get_price_html. |
|
get_price_including_tax ( integer $qty = 1, string $price = '' ) : string |
Returns the price (including tax). Uses customer tax rates. Can work for a specific $qty for more accurate taxes. |
|
get_price_suffix ( string $price = '', integer $qty = 1 ) : string |
Get the suffix to display after prices > 0. |
|
get_rating_html ( string $rating = null ) : string |
Returns the product rating in html format. |
|
get_related ( $limit = 5 ) |
Get and return related products. |
|
get_tags ( string $sep = ', ', string $before = '', string $after = '' ) : array |
Returns the product tags. |
|
get_total_stock ( ) : integer |
Get total stock - This is the stock of parent and children combined. |
|
get_upsells ( ) : array |
Returns the upsell product ids. |
|
get_variation_default_attributes ( ) : array |
If set, get the default attributes for a variable product. |
|
get_variation_description ( ) : string |
Get product variation description. |
|
get_variation_id ( ) : integer |
Get variation ID. |
|
grouped_product_sync ( ) |
|
|
has_all_attributes_set ( ) : boolean |
Check if all variation's attributes are set. |
|
has_default_attributes ( ) : boolean |
Check if variable product has default attributes set. |
|
increase_stock ( integer $amount = 1 ) : integer |
Increase stock level of the product. |
|
list_attributes ( ) |
Lists a table of attributes for the product page. |
|
parent_is_visible ( ) : boolean |
Returns whether or not the variations parent is visible. |
|
reduce_stock ( integer $amount = 1 ) : integer |
Reduce stock level of the product. |
|
set_stock ( $amount = null, $mode = 'set' ) |
Set stock level of the product. |
|
sync_attributes ( $product, $children = false ) |
Sync the variable product's attributes with the variations. |
|
sync_average_rating ( integer $post_id ) |
Sync product rating. Can be called statically. |
|
sync_rating_count ( integer $post_id ) |
Sync product rating count. Can be called statically. |
|
variable_product_sync ( $product_id = '' ) |
Sync variable product prices with the children lowest/highest prices. |
|