PHP Class WC_Product_External

External products cannot be bought; they link offsite. Extends simple products.
Author: WooThemes
Inheritance: extends WC_Product
Afficher le fichier Open project: woocommerce/woocommerce Class Usage Examples

Protected Properties

Свойство Type Description
$extra_data array Stores product data.

Méthodes publiques

Méthode Description
__construct ( integer | WC_Product | object $product ) Merges external product data into the parent object.
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.
get_button_text ( string $context = 'view' ) : string Get button text.
get_product_url ( string $context = 'view' ) : string Get product url.
get_type ( ) : string Get internal type.
is_purchasable ( ) : boolean Returns false if the product cannot be bought.
set_backorders ( string $backorders ) xternal products cannot be backordered.
set_button_text ( string $button_text ) Set button text.
set_manage_stock ( $manage_stock ) External products cannot be stock managed.
set_product_url ( string $product_url ) Set product URL.
set_stock_status ( $stock_status = '' ) External products cannot be stock managed.
single_add_to_cart_text ( ) : string Get the add to cart button text for the single page.

Méthodes protégées

Méthode Description
read_product_data ( ) Read post data.
update_post_meta ( ) Helper method that updates all the post meta for an external product.

Method Details

__construct() public méthode

Merges external product data into the parent object.
public __construct ( integer | WC_Product | object $product )
$product integer | WC_Product | object Product to init.

add_to_cart_text() public méthode

Get the add to cart button text.
public add_to_cart_text ( ) : string
Résultat string

add_to_cart_url() public méthode

Get the add to url used mainly in loops.
public add_to_cart_url ( ) : string
Résultat string

get_button_text() public méthode

Get button text.
public get_button_text ( string $context = 'view' ) : string
$context string
Résultat string

get_product_url() public méthode

Get product url.
public get_product_url ( string $context = 'view' ) : string
$context string
Résultat string

get_type() public méthode

Get internal type.
public get_type ( ) : string
Résultat string

is_purchasable() public méthode

Returns false if the product cannot be bought.
public is_purchasable ( ) : boolean
Résultat boolean

read_product_data() protected méthode

Read post data.
Since: 2.7.0
protected read_product_data ( )

set_backorders() public méthode

xternal products cannot be backordered.
Since: 2.7.0
public set_backorders ( string $backorders )
$backorders string Options: 'yes', 'no' or 'notify'.

set_button_text() public méthode

Set button text.
Since: 2.7.0
public set_button_text ( string $button_text )
$button_text string Button text.

set_manage_stock() public méthode

External products cannot be stock managed.
Since: 2.7.0
public set_manage_stock ( $manage_stock )

set_product_url() public méthode

Set product URL.
Since: 2.7.0
public set_product_url ( string $product_url )
$product_url string Product URL.

set_stock_status() public méthode

External products cannot be stock managed.
Since: 2.7.0
public set_stock_status ( $stock_status = '' )

single_add_to_cart_text() public méthode

Get the add to cart button text for the single page.
public single_add_to_cart_text ( ) : string
Résultat string

update_post_meta() protected méthode

Helper method that updates all the post meta for an external product.
Since: 2.7.0
protected update_post_meta ( )

Property Details

$extra_data protected_oe property

Stores product data.
protected array $extra_data
Résultat array