WC_Product::get_max_purchase_quantity
Get max quantity which can be purchased at once.
Метод класса: WC_Product{}
Хуки из метода
Возвращает
int|float. Quantity or -1 if unlimited.
Использование
$WC_Product = new WC_Product(); $WC_Product->get_max_purchase_quantity();
Список изменений
| С версии 3.0.0 | Введена. |
Код WC_Product::get_max_purchase_quantity() WC Product::get max purchase quantity WC 10.5.0
public function get_max_purchase_quantity() {
/**
* Filters the maximum quantity which can be purchased at once.
*
* @since 10.1.0
* @param int|float $quantity The maximum quantity.
* @param \WC_Product $this The product object.
* @return int|float The maximum quantity.
*/
return wc_stock_amount( apply_filters( 'woocommerce_quantity_input_max', $this->is_sold_individually() ? 1 : ( $this->backorders_allowed() || ! $this->managing_stock() ? -1 : $this->get_stock_quantity() ), $this ) );
}