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:
pierrebuet 2018-10-03 03:21:10 +02:00 committed by Mike Jolley
parent ade1021eff
commit 9ca3ae3453
1 changed files with 1 additions and 1 deletions

View File

@ -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() );
}
/**