set_value($value); } /** * Check if the availability is available. * * @since 0.8 * @return bool Whether the availability is available or not. */ public function is_available() { return $this->value === self::AVAILABLE; } /** * Check if the availability is out of stock. * * @since 0.8 * @return bool Whether the availability is out of stock or not. */ public function is_out_of_stock() { return $this->value === self::OUT_OF_STOCK; } /** * Get the translated label for the current value. * * @since 0.9.2 * @return string|null The translated label if any. */ public function get_label() { switch($this->value) { case self::AVAILABLE: $label = __('Available', 'affilicious'); break; case self::OUT_OF_STOCK: $label = __('Out of stock', 'affilicious'); break; default: $label = null; } $label = apply_filters('aff_shop_availability_label', $label, $this->value); return $label; } }