Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion inc/models/class-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1097,11 +1097,18 @@ public function is_recurring() {
/**
* Checks if this plan is free or not.
*
* Pay What You Want products are never considered free, even when the
* suggested and minimum amounts are zero — the customer decides the price.
*
* @since 2.0.0
* @return boolean
*/
public function is_free() {

if ($this->is_pay_what_you_want()) {
return false;
}

return empty($this->get_amount()) && empty($this->get_initial_amount());
}

Expand Down Expand Up @@ -1634,7 +1641,7 @@ public function save() {
$this->set_slug(sanitize_title($this->name));
}

if ($this->is_free() && $this->get_pricing_type() !== 'contact_us') {
if ($this->is_free() && 'paid' === $this->get_pricing_type()) {
$this->set_pricing_type('free');
}

Expand Down
Loading