getActiveRoleSettings(); if ( $roleSettings && ! empty( $roleSettings['display_shop'] ) && 'default' !== $roleSettings['display_shop'] ) { return $roleSettings['display_shop']; // 'incl' or 'excl' } return $value; } public function overrideDisplayCart( $value ) { $roleSettings = $this->getActiveRoleSettings(); if ( $roleSettings && ! empty( $roleSettings['display_cart'] ) && 'default' !== $roleSettings['display_cart'] ) { return $roleSettings['display_cart']; // 'incl' or 'excl' } return $value; } public function overridePriceSuffix( $value ) { $roleSettings = $this->getActiveRoleSettings(); if ( $roleSettings && isset( $roleSettings['price_suffix'] ) && '' !== $roleSettings['price_suffix'] && 'default' !== $roleSettings['price_suffix'] ) { return $roleSettings['price_suffix']; } return $value; } public function overridePricesIncludeTax( $value ) { $roleSettings = $this->getActiveRoleSettings(); if ( $roleSettings && ! empty( $roleSettings['prices_include_tax'] ) && 'default' !== $roleSettings['prices_include_tax'] ) { return $roleSettings['prices_include_tax']; // 'yes' or 'no' } return $value; } public function overrideTaxClass( $taxClass, $product ) { $roleSettings = $this->getActiveRoleSettings(); if ( $roleSettings && ! empty( $roleSettings['tax_class'] ) && 'default' !== $roleSettings['tax_class'] ) { return 'standard' === $roleSettings['tax_class'] ? '' : $roleSettings['tax_class']; } return $taxClass; } public function setTaxExempt() { if ( ! function_exists( 'WC' ) || ! isset( WC()->customer ) ) { return; } $roleSettings = $this->getActiveRoleSettings(); if ( $roleSettings && isset( $roleSettings['tax_exempt'] ) && $roleSettings['tax_exempt'] ) { WC()->customer->set_is_vat_exempt( true ); } } }