Check for customer before checking for VAT excemption
In the actual form, the check done in the function is_taxable() of a shipping method can only be done in the frontend, since WC()->customer must be defined. Checking for a customer before checking the excemption would make the function also callable in the backend for different pre-calculation. If a customer is not defined, an exemption can not exists.
This commit is contained in:
parent
ade1021eff
commit
9ca3ae3453
|
@ -168,7 +168,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
|||
* @return boolean
|
||||
*/
|
||||
public function is_taxable() {
|
||||
return wc_tax_enabled() && 'taxable' === $this->tax_status && ! WC()->customer->get_is_vat_exempt();
|
||||
return wc_tax_enabled() && 'taxable' === $this->tax_status && ( WC()->customer && ! WC()->customer->get_is_vat_exempt() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue