File "class-wc-product-external.php"
Full path: /home/kosmetik/public_html/wp-content/plugins/woocommerce/includes/class-wc-product-external.php
File
size: 2.58 B
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
defined('ABSPATH') || exit;
class WC_Product_External extends WC_Product
{
protected $extra_data = array('product_url' => '', 'button_text' => '');
public function get_type()
{
return 'external';
}
public function get_product_url($context = 'view')
{
return esc_url_raw($this->get_prop('product_url', $context));
}
public function get_button_text($context = 'view')
{
return $this->get_prop('button_text', $context);
}
public function set_product_url($product_url)
{
$this->set_prop('product_url', htmlspecialchars_decode($product_url));
}
public function set_button_text($button_text)
{
$this->set_prop('button_text', $button_text);
}
public function set_manage_stock($manage_stock)
{
$this->set_prop('manage_stock', false);
if (true === $manage_stock) {
$this->error('product_external_invalid_manage_stock', __('External products cannot be stock managed.', 'woocommerce'));
}
}
public function set_stock_status($stock_status = '')
{
$this->set_prop('stock_status', 'instock');
if ('instock' !== $stock_status) {
$this->error('product_external_invalid_stock_status', __('External products cannot be stock managed.', 'woocommerce'));
}
}
public function set_backorders($backorders)
{
$this->set_prop('backorders', 'no');
if ('no' !== $backorders) {
$this->error('product_external_invalid_backorders', __('External products cannot be backordered.', 'woocommerce'));
}
}
public function is_purchasable()
{
return apply_filters('woocommerce_is_purchasable', false, $this);
}
public function add_to_cart_url()
{
return apply_filters('woocommerce_product_add_to_cart_url', $this->get_product_url(), $this);
}
public function single_add_to_cart_text()
{
return apply_filters('woocommerce_product_single_add_to_cart_text', $this->get_button_text() ? $this->get_button_text() : _x('Buy product', 'placeholder', 'woocommerce'), $this);
}
public function add_to_cart_text()
{
return apply_filters('woocommerce_product_add_to_cart_text', $this->get_button_text() ? $this->get_button_text() : _x('Buy product', 'placeholder', 'woocommerce'), $this);
}
public function add_to_cart_description()
{
return apply_filters('woocommerce_product_add_to_cart_description', $this->get_button_text() ? $this->get_button_text() : sprintf(__('Buy “%s”', 'woocommerce'), $this->get_name()), $this);
}
}