PHP 클래스 WC_Product

The WooCommerce product class handles individual product data.
저자: WooThemes
파일 보기 프로젝트 열기: woocommerce/woocommerce 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$cache_group string Cache group.
$data array Stores product data.
$post_type string Post type.
$supports array Supported features such as 'ajax_add_to_cart'.

공개 메소드들

메소드 설명
__construct ( integer | WC_Product | object $product ) Get the product if ID is passed, otherwise the product is new and empty.
add_to_cart_text ( ) : string Get the add to cart button text.
add_to_cart_url ( ) : string Get the add to url used mainly in loops.
backorders_allowed ( ) : boolean Returns whether or not the product can be backordered.
backorders_require_notification ( ) : boolean Returns whether or not the product needs to notify the customer on backorder.
child_has_dimensions ( ) : boolean Does a child have dimensions?
child_has_weight ( ) : boolean Does a child have a weight?
exists ( ) : boolean Returns whether or not the product post exists.
get_attribute ( string $attribute ) : string Returns a single product attribute as a string.
get_attributes ( string $context = 'view' ) : array Returns product attributes.
get_average_rating ( string $context = 'view' ) : float Get average rating.
get_backorders ( string $context = 'view' ) : string Get backorders.
get_catalog_visibility ( string $context = 'view' ) : string Get catalog visibility.
get_category_ids ( string $context = 'view' ) : array Get category ids.
get_children ( ) : array Returns the children IDs if applicable. Overridden by child classes.
get_cross_sell_ids ( string $context = 'view' ) : array Get cross sell IDs.
get_data ( ) : array Get all class data in array format.
get_date_created ( string $context = 'view' ) : string Get product created date.
get_date_modified ( string $context = 'view' ) : string Get product modified date.
get_date_on_sale_from ( string $context = 'view' ) : string Get date on sale from.
get_date_on_sale_to ( string $context = 'view' ) : string Get date on sale to.
get_default_attributes ( string $context = 'view' ) : array Get default attributes.
get_description ( string $context = 'view' ) : string Get product description.
get_dimensions ( $formatted = true ) : string | array Returns formatted dimensions.
get_download_expiry ( string $context = 'view' ) : integer Get download expiry.
get_download_limit ( string $context = 'view' ) : integer Get download limit.
get_downloadable ( string $context = 'view' ) : boolean Get downloadable.
get_downloads ( string $context = 'view' ) : array Get downloads.
get_featured ( string $context = 'view' ) : boolean If the product is featured.
get_file ( string $download_id = '' ) : array | false Get a file by $download_id.
get_file_download_path ( string $download_id ) : string Get file download path identified by $download_id.
get_formatted_name ( ) : string Get product name with SKU or ID. Used within admin.
get_gallery_image_ids ( string $context = 'view' ) : array Returns the gallery attachment ids.
get_height ( string $context = 'view' ) : string Returns the product height.
get_image ( string $size = 'shop_thumbnail', array $attr = [], $placeholder = true ) : string Returns the main product image.
get_image_id ( string $context = 'view' ) : string Get main image ID.
get_length ( string $context = 'view' ) : string Returns the product length.
get_manage_stock ( string $context = 'view' ) : boolean Return if product manage stock.
get_menu_order ( string $context = 'view' ) : integer Get menu order.
get_name ( string $context = 'view' ) : string Get product name.
get_parent_id ( string $context = 'view' ) : integer Get parent ID.
get_permalink ( ) : string Product permalink.
get_price ( string $context = 'view' ) : string Returns the product's active price.
get_price_html ( $deprecated = '' ) : string Returns the price in html format.
get_purchase_note ( string $context = 'view' ) : string Get purchase note.
get_rating_count ( integer $value = null ) : integer Get the total amount (COUNT) of ratings, or just the count for one rating e.g. number of 5 star ratings.
get_rating_counts ( string $context = 'view' ) : array Get rating count.
get_regular_price ( string $context = 'view' ) : string Returns the product's regular price.
get_review_count ( string $context = 'view' ) : integer Get review count.
get_reviews_allowed ( string $context = 'view' ) : boolean Return if reviews is allowed.
get_sale_price ( string $context = 'view' ) : string Returns the product's sale price.
get_shipping_class ( ) : string Returns the product shipping class SLUG.
get_shipping_class_id ( string $context = 'view' ) : integer Get shipping class ID.
get_short_description ( string $context = 'view' ) : string Get product short description.
get_sku ( string $context = 'view' ) : string Get SKU (Stock-keeping unit) - product unique ID.
get_slug ( string $context = 'view' ) : string Get product slug.
get_sold_individually ( string $context = 'view' ) : boolean Return if should be sold individually.
get_status ( string $context = 'view' ) : string Get product status.
get_stock_managed_by_id ( ) : integer If the stock level comes from another product ID, this should be modified.
get_stock_quantity ( string $context = 'view' ) : integer | null Returns number of items available for sale.
get_stock_status ( string $context = 'view' ) : string Return the stock status.
get_tag_ids ( string $context = 'view' ) : array Get tag ids.
get_tax_class ( string $context = 'view' ) : string Returns the tax class.
get_tax_status ( string $context = 'view' ) : string Returns the tax status.
get_title ( ) : string Get the product's title. For products this is the product name.
get_total_sales ( string $context = 'view' ) : integer Get number total of sales.
get_type ( ) : string Get internal type. Should return string and *should be overridden* by child classes.
get_upsell_ids ( string $context = 'view' ) : array Get upsel IDs.
get_virtual ( string $context = 'view' ) : boolean Get virtual.
get_weight ( string $context = 'view' ) : string Returns the product's weight.
get_width ( string $context = 'view' ) : string Returns the product width.
has_attributes ( ) : boolean Returns whether or not the product has any visible attributes.
has_child ( ) : boolean Returns whether or not the product has any child product.
has_dimensions ( ) : boolean Returns whether or not the product has dimensions set.
has_enough_stock ( mixed $quantity ) : boolean Returns whether or not the product has enough stock for the order.
has_file ( string $download_id = '' ) : boolean Check if downloadable product has a file attached.
has_weight ( ) : boolean Returns whether or not the product has weight set.
is_downloadable ( ) : boolean Checks if a product is downloadable.
is_featured ( ) : boolean Returns whether or not the product is featured.
is_in_stock ( ) : boolean Returns whether or not the product is in stock.
is_on_backorder ( integer $qty_in_cart ) : boolean Check if a product is on backorder.
is_on_sale ( ) : boolean Returns whether or not the product is on sale.
is_purchasable ( ) : boolean Returns false if the product cannot be bought.
is_shipping_taxable ( ) : boolean Returns whether or not the product shipping is taxable.
is_sold_individually ( ) : boolean Check if a product is sold individually (no quantities).
is_taxable ( ) : boolean Returns whether or not the product is taxable.
is_type ( string $type ) : boolean Checks the product type.
is_virtual ( ) : boolean Checks if a product is virtual (has no shipping).
is_visible ( ) : boolean Returns whether or not the product is visible in the catalog.
managing_stock ( ) : boolean Returns whether or not the product is stock managed.
needs_shipping ( ) : boolean Checks if a product needs shipping.
save ( ) Save data (either create or update depending on if we are working on an existing product).
set_attributes ( array $raw_attributes ) Set product attributes.
set_average_rating ( float $average ) Set average rating. Read only.
set_backorders ( string $backorders ) Set backorders.
set_catalog_visibility ( string $visibility ) Set catalog visibility.
set_category_ids ( array $term_ids ) Set the product categories.
set_cross_sell_ids ( array $cross_sell_ids ) Set crosssell IDs.
set_date_created ( string $timestamp ) Set product created date.
set_date_modified ( string $timestamp ) Set product modified date.
set_date_on_sale_from ( string $timestamp ) Set date on sale from.
set_date_on_sale_to ( string $timestamp ) Set date on sale to.
set_default_attributes ( array $default_attributes ) Set default attributes.
set_description ( string $description ) Set product description.
set_download_expiry ( integer $download_expiry ) Set download expiry.
set_download_limit ( integer $download_limit ) Set download limit.
set_downloadable ( $downloadable ) Set if the product is downloadable.
set_downloads ( $downloads_array ) Set downloads.
set_featured ( $featured ) Set if the product is featured.
set_gallery_image_ids ( array $image_ids ) Set gallery attachment ids.
set_height ( float | string $height ) Set the product height.
set_image_id ( integer $image_id = '' ) Set main image ID.
set_length ( float | string $length ) Set the product length.
set_manage_stock ( $manage_stock ) Set if product manage stock.
set_menu_order ( integer $menu_order ) Set menu order.
set_name ( string $name ) Set product name.
set_parent_id ( integer $parent_id ) Set parent ID.
set_price ( string $price ) Set the product's active price.
set_purchase_note ( string $purchase_note ) Set purchase note.
set_rating_counts ( array $counts ) Set rating counts. Read only.
set_regular_price ( string $price ) Set the product's regular price.
set_review_count ( integer $count ) Set review count. Read only.
set_reviews_allowed ( boolean $reviews_allowed ) Set if reviews is allowed.
set_sale_price ( string $price ) Set the product's sale price.
set_shipping_class_id ( $id ) Set shipping class ID.
set_short_description ( string $short_description ) Set product short description.
set_sku ( string $sku ) Set SKU.
set_slug ( string $slug ) Set product slug.
set_sold_individually ( $sold_individually ) Set if should be sold individually.
set_status ( string $status ) Set product status.
set_stock_quantity ( float | null $quantity ) Set number of items available for sale.
set_stock_status ( string $status = '' ) Set stock status.
set_tag_ids ( array $term_ids ) Set the product tags.
set_tax_class ( string $class ) Set the tax class.
set_tax_status ( string $status ) Set the tax status.
set_total_sales ( integer $total ) Set number total of sales.
set_upsell_ids ( array $upsell_ids ) Set upsell IDs.
set_virtual ( $virtual ) Set if the product is virtual.
set_weight ( float | string $weight ) Set the product's weight.
set_width ( float | string $width ) Set the product width.
single_add_to_cart_text ( ) : string Get the add to cart button text for the single page.
supports ( string $feature ) : boolean Check if a product supports a given feature.
validate_props ( ) Ensure properties are set correctly before save.

보호된 메소드들

메소드 설명
get_hook_prefix ( ) : string Prefix for action and filter hooks on data.
sanitize_term_ids ( array $terms, string $taxonomy ) Get term ids from either a list of names, ids, or terms.

메소드 상세

__construct() 공개 메소드

This class should NOT be instantiated, but the wc_get_product() function should be used. It is possible, but the wc_get_product() is preferred.
public __construct ( integer | WC_Product | object $product )
$product integer | WC_Product | object Product to init.

add_to_cart_text() 공개 메소드

Get the add to cart button text.
public add_to_cart_text ( ) : string
리턴 string

add_to_cart_url() 공개 메소드

Get the add to url used mainly in loops.
public add_to_cart_url ( ) : string
리턴 string

backorders_allowed() 공개 메소드

Returns whether or not the product can be backordered.
public backorders_allowed ( ) : boolean
리턴 boolean

backorders_require_notification() 공개 메소드

Returns whether or not the product needs to notify the customer on backorder.

child_has_dimensions() 공개 메소드

Does a child have dimensions?
부터: 2.7.0
public child_has_dimensions ( ) : boolean
리턴 boolean

child_has_weight() 공개 메소드

Does a child have a weight?
부터: 2.7.0
public child_has_weight ( ) : boolean
리턴 boolean

exists() 공개 메소드

Returns whether or not the product post exists.
public exists ( ) : boolean
리턴 boolean

get_attribute() 공개 메소드

Returns a single product attribute as a string.
public get_attribute ( string $attribute ) : string
$attribute string to get.
리턴 string

get_attributes() 공개 메소드

Returns product attributes.
public get_attributes ( string $context = 'view' ) : array
$context string
리턴 array

get_average_rating() 공개 메소드

Get average rating.
public get_average_rating ( string $context = 'view' ) : float
$context string
리턴 float

get_backorders() 공개 메소드

Get backorders.
부터: 2.7.0
public get_backorders ( string $context = 'view' ) : string
$context string
리턴 string yes no or notify

get_catalog_visibility() 공개 메소드

Get catalog visibility.
부터: 2.7.0
public get_catalog_visibility ( string $context = 'view' ) : string
$context string
리턴 string

get_category_ids() 공개 메소드

Get category ids.
부터: 2.7.0
public get_category_ids ( string $context = 'view' ) : array
$context string
리턴 array

get_children() 공개 메소드

Returns the children IDs if applicable. Overridden by child classes.
public get_children ( ) : array
리턴 array of IDs

get_cross_sell_ids() 공개 메소드

Get cross sell IDs.
부터: 2.7.0
public get_cross_sell_ids ( string $context = 'view' ) : array
$context string
리턴 array

get_data() 공개 메소드

Get all class data in array format.
부터: 2.7.0
public get_data ( ) : array
리턴 array

get_date_created() 공개 메소드

Get product created date.
부터: 2.7.0
public get_date_created ( string $context = 'view' ) : string
$context string
리턴 string Timestamp.

get_date_modified() 공개 메소드

Get product modified date.
부터: 2.7.0
public get_date_modified ( string $context = 'view' ) : string
$context string
리턴 string Timestamp.

get_date_on_sale_from() 공개 메소드

Get date on sale from.
부터: 2.7.0
public get_date_on_sale_from ( string $context = 'view' ) : string
$context string
리턴 string

get_date_on_sale_to() 공개 메소드

Get date on sale to.
부터: 2.7.0
public get_date_on_sale_to ( string $context = 'view' ) : string
$context string
리턴 string

get_default_attributes() 공개 메소드

Get default attributes.
부터: 2.7.0
public get_default_attributes ( string $context = 'view' ) : array
$context string
리턴 array

get_description() 공개 메소드

Get product description.
부터: 2.7.0
public get_description ( string $context = 'view' ) : string
$context string
리턴 string

get_dimensions() 공개 메소드

Returns formatted dimensions.
public get_dimensions ( $formatted = true ) : string | array
$formatted True by default for legacy support - will be false/not set in future versions to return the array only. Use wc_format_dimensions for formatted versions instead.
리턴 string | array

get_download_expiry() 공개 메소드

Get download expiry.
부터: 2.7.0
public get_download_expiry ( string $context = 'view' ) : integer
$context string
리턴 integer

get_download_limit() 공개 메소드

Get download limit.
부터: 2.7.0
public get_download_limit ( string $context = 'view' ) : integer
$context string
리턴 integer

get_downloadable() 공개 메소드

Get downloadable.
부터: 2.7.0
public get_downloadable ( string $context = 'view' ) : boolean
$context string
리턴 boolean

get_downloads() 공개 메소드

Get downloads.
부터: 2.7.0
public get_downloads ( string $context = 'view' ) : array
$context string
리턴 array

get_file() 공개 메소드

Get a file by $download_id.
public get_file ( string $download_id = '' ) : array | false
$download_id string file identifier
리턴 array | false if not found

get_file_download_path() 공개 메소드

Get file download path identified by $download_id.
public get_file_download_path ( string $download_id ) : string
$download_id string file identifier
리턴 string

get_formatted_name() 공개 메소드

Get product name with SKU or ID. Used within admin.
public get_formatted_name ( ) : string
리턴 string Formatted product name

get_height() 공개 메소드

Returns the product height.
public get_height ( string $context = 'view' ) : string
$context string
리턴 string

get_hook_prefix() 보호된 메소드

Prefix for action and filter hooks on data.
부터: 2.7.0
protected get_hook_prefix ( ) : string
리턴 string

get_image() 공개 메소드

Returns the main product image.
public get_image ( string $size = 'shop_thumbnail', array $attr = [], $placeholder = true ) : string
$size string (default: 'shop_thumbnail')
$attr array
리턴 string

get_image_id() 공개 메소드

Get main image ID.
부터: 2.7.0
public get_image_id ( string $context = 'view' ) : string
$context string
리턴 string

get_length() 공개 메소드

Returns the product length.
public get_length ( string $context = 'view' ) : string
$context string
리턴 string

get_manage_stock() 공개 메소드

Return if product manage stock.
부터: 2.7.0
public get_manage_stock ( string $context = 'view' ) : boolean
$context string
리턴 boolean

get_menu_order() 공개 메소드

Get menu order.
부터: 2.7.0
public get_menu_order ( string $context = 'view' ) : integer
$context string
리턴 integer

get_name() 공개 메소드

Get product name.
부터: 2.7.0
public get_name ( string $context = 'view' ) : string
$context string
리턴 string

get_parent_id() 공개 메소드

Get parent ID.
부터: 2.7.0
public get_parent_id ( string $context = 'view' ) : integer
$context string
리턴 integer

get_price() 공개 메소드

Returns the product's active price.
public get_price ( string $context = 'view' ) : string
$context string
리턴 string price

get_price_html() 공개 메소드

Returns the price in html format.
public get_price_html ( $deprecated = '' ) : string
리턴 string

get_purchase_note() 공개 메소드

Get purchase note.
부터: 2.7.0
public get_purchase_note ( string $context = 'view' ) : string
$context string
리턴 string

get_rating_count() 공개 메소드

Get the total amount (COUNT) of ratings, or just the count for one rating e.g. number of 5 star ratings.
public get_rating_count ( integer $value = null ) : integer
$value integer Optional. Rating value to get the count for. By default returns the count of all rating values.
리턴 integer

get_rating_counts() 공개 메소드

Get rating count.
public get_rating_counts ( string $context = 'view' ) : array
$context string
리턴 array of counts

get_regular_price() 공개 메소드

Returns the product's regular price.
public get_regular_price ( string $context = 'view' ) : string
$context string
리턴 string price

get_review_count() 공개 메소드

Get review count.
public get_review_count ( string $context = 'view' ) : integer
$context string
리턴 integer

get_reviews_allowed() 공개 메소드

Return if reviews is allowed.
부터: 2.7.0
public get_reviews_allowed ( string $context = 'view' ) : boolean
$context string
리턴 boolean

get_sale_price() 공개 메소드

Returns the product's sale price.
public get_sale_price ( string $context = 'view' ) : string
$context string
리턴 string price

get_shipping_class() 공개 메소드

Returns the product shipping class SLUG.
public get_shipping_class ( ) : string
리턴 string

get_shipping_class_id() 공개 메소드

Get shipping class ID.
부터: 2.7.0
public get_shipping_class_id ( string $context = 'view' ) : integer
$context string
리턴 integer

get_short_description() 공개 메소드

Get product short description.
부터: 2.7.0
public get_short_description ( string $context = 'view' ) : string
$context string
리턴 string

get_sku() 공개 메소드

Get SKU (Stock-keeping unit) - product unique ID.
public get_sku ( string $context = 'view' ) : string
$context string
리턴 string

get_slug() 공개 메소드

Get product slug.
부터: 2.7.0
public get_slug ( string $context = 'view' ) : string
$context string
리턴 string

get_sold_individually() 공개 메소드

Return if should be sold individually.
부터: 2.7.0
public get_sold_individually ( string $context = 'view' ) : boolean
$context string
리턴 boolean

get_status() 공개 메소드

Get product status.
부터: 2.7.0
public get_status ( string $context = 'view' ) : string
$context string
리턴 string

get_stock_managed_by_id() 공개 메소드

If the stock level comes from another product ID, this should be modified.
부터: 2.7.0

get_stock_quantity() 공개 메소드

Returns number of items available for sale.
public get_stock_quantity ( string $context = 'view' ) : integer | null
$context string
리턴 integer | null

get_stock_status() 공개 메소드

Return the stock status.
부터: 2.7.0
public get_stock_status ( string $context = 'view' ) : string
$context string
리턴 string

get_tag_ids() 공개 메소드

Get tag ids.
부터: 2.7.0
public get_tag_ids ( string $context = 'view' ) : array
$context string
리턴 array

get_tax_class() 공개 메소드

Returns the tax class.
public get_tax_class ( string $context = 'view' ) : string
$context string
리턴 string

get_tax_status() 공개 메소드

Returns the tax status.
public get_tax_status ( string $context = 'view' ) : string
$context string
리턴 string

get_title() 공개 메소드

Get the product's title. For products this is the product name.
public get_title ( ) : string
리턴 string

get_total_sales() 공개 메소드

Get number total of sales.
부터: 2.7.0
public get_total_sales ( string $context = 'view' ) : integer
$context string
리턴 integer

get_type() 공개 메소드

Get internal type. Should return string and *should be overridden* by child classes.
부터: 2.7.0
public get_type ( ) : string
리턴 string

get_upsell_ids() 공개 메소드

Get upsel IDs.
부터: 2.7.0
public get_upsell_ids ( string $context = 'view' ) : array
$context string
리턴 array

get_virtual() 공개 메소드

Get virtual.
부터: 2.7.0
public get_virtual ( string $context = 'view' ) : boolean
$context string
리턴 boolean

get_weight() 공개 메소드

Returns the product's weight.
public get_weight ( string $context = 'view' ) : string
$context string
리턴 string

get_width() 공개 메소드

Returns the product width.
public get_width ( string $context = 'view' ) : string
$context string
리턴 string

has_attributes() 공개 메소드

Returns whether or not the product has any visible attributes.
public has_attributes ( ) : boolean
리턴 boolean

has_child() 공개 메소드

Returns whether or not the product has any child product.
public has_child ( ) : boolean
리턴 boolean

has_dimensions() 공개 메소드

Returns whether or not the product has dimensions set.
public has_dimensions ( ) : boolean
리턴 boolean

has_enough_stock() 공개 메소드

Returns whether or not the product has enough stock for the order.
public has_enough_stock ( mixed $quantity ) : boolean
$quantity mixed
리턴 boolean

has_file() 공개 메소드

Check if downloadable product has a file attached.
부터: 1.6.2
public has_file ( string $download_id = '' ) : boolean
$download_id string file identifier
리턴 boolean Whether downloadable product has a file attached.

has_weight() 공개 메소드

Returns whether or not the product has weight set.
public has_weight ( ) : boolean
리턴 boolean

is_downloadable() 공개 메소드

Checks if a product is downloadable.
public is_downloadable ( ) : boolean
리턴 boolean

is_in_stock() 공개 메소드

Returns whether or not the product is in stock.
public is_in_stock ( ) : boolean
리턴 boolean

is_on_backorder() 공개 메소드

Check if a product is on backorder.
public is_on_backorder ( integer $qty_in_cart ) : boolean
$qty_in_cart integer (default: 0)
리턴 boolean

is_on_sale() 공개 메소드

Returns whether or not the product is on sale.
public is_on_sale ( ) : boolean
리턴 boolean

is_purchasable() 공개 메소드

Returns false if the product cannot be bought.
public is_purchasable ( ) : boolean
리턴 boolean

is_shipping_taxable() 공개 메소드

Returns whether or not the product shipping is taxable.
public is_shipping_taxable ( ) : boolean
리턴 boolean

is_sold_individually() 공개 메소드

Check if a product is sold individually (no quantities).
public is_sold_individually ( ) : boolean
리턴 boolean

is_taxable() 공개 메소드

Returns whether or not the product is taxable.
public is_taxable ( ) : boolean
리턴 boolean

is_type() 공개 메소드

Backwards compat with downloadable/virtual.
public is_type ( string $type ) : boolean
$type string Array or string of types
리턴 boolean

is_virtual() 공개 메소드

Checks if a product is virtual (has no shipping).
public is_virtual ( ) : boolean
리턴 boolean

is_visible() 공개 메소드

Returns whether or not the product is visible in the catalog.
public is_visible ( ) : boolean
리턴 boolean

managing_stock() 공개 메소드

Returns whether or not the product is stock managed.
public managing_stock ( ) : boolean
리턴 boolean

needs_shipping() 공개 메소드

Checks if a product needs shipping.
public needs_shipping ( ) : boolean
리턴 boolean

sanitize_term_ids() 보호된 메소드

Get term ids from either a list of names, ids, or terms.
부터: 2.7.0
protected sanitize_term_ids ( array $terms, string $taxonomy )
$terms array
$taxonomy string

save() 공개 메소드

Save data (either create or update depending on if we are working on an existing product).
부터: 2.7.0
public save ( )

set_attributes() 공개 메소드

Attributes are made up of: id - 0 for product level attributes. ID for global attributes. name - Attribute name. options - attribute value or array of term ids/names. position - integer sort order. visible - If visible on frontend. variation - If used for variations. Indexed by unqiue key to allow clearing old ones after a set.
부터: 2.7.0
public set_attributes ( array $raw_attributes )
$raw_attributes array Array of WC_Product_Attribute objects.

set_average_rating() 공개 메소드

Set average rating. Read only.
public set_average_rating ( float $average )
$average float

set_backorders() 공개 메소드

Set backorders.
부터: 2.7.0
public set_backorders ( string $backorders )
$backorders string Options: 'yes', 'no' or 'notify'.

set_catalog_visibility() 공개 메소드

Set catalog visibility.
부터: 2.7.0
public set_catalog_visibility ( string $visibility )
$visibility string Options: 'hidden', 'visible', 'search' and 'catalog'.

set_category_ids() 공개 메소드

Set the product categories.
부터: 2.7.0
public set_category_ids ( array $term_ids )
$term_ids array List of terms IDs.

set_cross_sell_ids() 공개 메소드

Set crosssell IDs.
부터: 2.7.0
public set_cross_sell_ids ( array $cross_sell_ids )
$cross_sell_ids array IDs from the cross-sell products.

set_date_created() 공개 메소드

Set product created date.
부터: 2.7.0
public set_date_created ( string $timestamp )
$timestamp string Timestamp.

set_date_modified() 공개 메소드

Set product modified date.
부터: 2.7.0
public set_date_modified ( string $timestamp )
$timestamp string Timestamp.

set_date_on_sale_from() 공개 메소드

Set date on sale from.
부터: 2.7.0
public set_date_on_sale_from ( string $timestamp )
$timestamp string Sale from date.

set_date_on_sale_to() 공개 메소드

Set date on sale to.
부터: 2.7.0
public set_date_on_sale_to ( string $timestamp )
$timestamp string Sale to date.

set_default_attributes() 공개 메소드

Set default attributes.
부터: 2.7.0
public set_default_attributes ( array $default_attributes )
$default_attributes array List of default attributes.

set_description() 공개 메소드

Set product description.
부터: 2.7.0
public set_description ( string $description )
$description string Product description.

set_download_expiry() 공개 메소드

Set download expiry.
부터: 2.7.0
public set_download_expiry ( integer $download_expiry )
$download_expiry integer

set_download_limit() 공개 메소드

Set download limit.
부터: 2.7.0
public set_download_limit ( integer $download_limit )
$download_limit integer

set_downloadable() 공개 메소드

Set if the product is downloadable.
부터: 2.7.0
public set_downloadable ( $downloadable )

set_downloads() 공개 메소드

Set downloads.
부터: 2.7.0
public set_downloads ( $downloads_array )
$downloads_array array of WC_Product_Download objects or arrays.

set_height() 공개 메소드

Set the product height.
부터: 2.7.0
public set_height ( float | string $height )
$height float | string Total height.

set_image_id() 공개 메소드

Set main image ID.
부터: 2.7.0
public set_image_id ( integer $image_id = '' )
$image_id integer

set_length() 공개 메소드

Set the product length.
부터: 2.7.0
public set_length ( float | string $length )
$length float | string Total length.

set_manage_stock() 공개 메소드

Set if product manage stock.
부터: 2.7.0
public set_manage_stock ( $manage_stock )

set_menu_order() 공개 메소드

Set menu order.
부터: 2.7.0
public set_menu_order ( integer $menu_order )
$menu_order integer Menu order.

set_name() 공개 메소드

Set product name.
부터: 2.7.0
public set_name ( string $name )
$name string Product name.

set_parent_id() 공개 메소드

Set parent ID.
부터: 2.7.0
public set_parent_id ( integer $parent_id )
$parent_id integer Product parent ID.

set_price() 공개 메소드

Set the product's active price.
public set_price ( string $price )
$price string Price.

set_purchase_note() 공개 메소드

Set purchase note.
부터: 2.7.0
public set_purchase_note ( string $purchase_note )
$purchase_note string Purchase note.

set_rating_counts() 공개 메소드

Set rating counts. Read only.
public set_rating_counts ( array $counts )
$counts array

set_regular_price() 공개 메소드

Set the product's regular price.
부터: 2.7.0
public set_regular_price ( string $price )
$price string Regular price.

set_review_count() 공개 메소드

Set review count. Read only.
public set_review_count ( integer $count )
$count integer

set_reviews_allowed() 공개 메소드

Set if reviews is allowed.
부터: 2.7.0
public set_reviews_allowed ( boolean $reviews_allowed )
$reviews_allowed boolean Reviews allowed or not.

set_sale_price() 공개 메소드

Set the product's sale price.
부터: 2.7.0
public set_sale_price ( string $price )
$price string sale price.

set_shipping_class_id() 공개 메소드

Set shipping class ID.
부터: 2.7.0
public set_shipping_class_id ( $id )

set_short_description() 공개 메소드

Set product short description.
부터: 2.7.0
public set_short_description ( string $short_description )
$short_description string Product short description.

set_sku() 공개 메소드

Set SKU.
부터: 2.7.0
public set_sku ( string $sku )
$sku string Product SKU.

set_slug() 공개 메소드

Set product slug.
부터: 2.7.0
public set_slug ( string $slug )
$slug string Product slug.

set_sold_individually() 공개 메소드

Set if should be sold individually.
부터: 2.7.0
public set_sold_individually ( $sold_individually )

set_status() 공개 메소드

Set product status.
부터: 2.7.0
public set_status ( string $status )
$status string Product status.

set_stock_quantity() 공개 메소드

Set number of items available for sale.
부터: 2.7.0
public set_stock_quantity ( float | null $quantity )
$quantity float | null Stock quantity.

set_stock_status() 공개 메소드

Set stock status.
public set_stock_status ( string $status = '' )
$status string New status.

set_tag_ids() 공개 메소드

Set the product tags.
부터: 2.7.0
public set_tag_ids ( array $term_ids )
$term_ids array List of terms IDs.

set_tax_class() 공개 메소드

Set the tax class.
부터: 2.7.0
public set_tax_class ( string $class )
$class string Tax class.

set_tax_status() 공개 메소드

Set the tax status.
부터: 2.7.0
public set_tax_status ( string $status )
$status string Tax status.

set_total_sales() 공개 메소드

Set number total of sales.
부터: 2.7.0
public set_total_sales ( integer $total )
$total integer Total of sales.

set_upsell_ids() 공개 메소드

Set upsell IDs.
부터: 2.7.0
public set_upsell_ids ( array $upsell_ids )
$upsell_ids array IDs from the up-sell products.

set_virtual() 공개 메소드

Set if the product is virtual.
부터: 2.7.0
public set_virtual ( $virtual )

set_weight() 공개 메소드

Set the product's weight.
부터: 2.7.0
public set_weight ( float | string $weight )
$weight float | string Total weight.

set_width() 공개 메소드

Set the product width.
부터: 2.7.0
public set_width ( float | string $width )
$width float | string Total width.

single_add_to_cart_text() 공개 메소드

Get the add to cart button text for the single page.
public single_add_to_cart_text ( ) : string
리턴 string

supports() 공개 메소드

Product classes should override this to declare support (or lack of support) for a feature.
부터: 2.5.0
public supports ( string $feature ) : boolean
$feature string string The name of a feature to test support for.
리턴 boolean True if the product supports the feature, false otherwise.

validate_props() 공개 메소드

Ensure properties are set correctly before save.
부터: 2.7.0
public validate_props ( )

프로퍼티 상세

$cache_group 보호되어 있는 프로퍼티

Cache group.
protected string $cache_group
리턴 string

$data 보호되어 있는 프로퍼티

Stores product data.
protected array $data
리턴 array

$post_type 보호되어 있는 프로퍼티

Post type.
protected string $post_type
리턴 string

$supports 보호되어 있는 프로퍼티

Supported features such as 'ajax_add_to_cart'.
protected array $supports
리턴 array