| 1 |
<?php namespace TierPricingTable\Addons\CustomColumns\Columns; |
| 2 |
|
| 3 |
use TierPricingTable\PricingRule; |
| 4 |
|
| 5 |
class PriceIncludingTaxesColumn extends AbstractCustomColumn { |
| 6 |
|
| 7 |
const TYPE = 'price_incl_taxes'; |
| 8 |
|
| 9 |
public function getType(): string { |
| 10 |
return self::TYPE; |
| 11 |
} |
| 12 |
|
| 13 |
public function getDataType(): string { |
| 14 |
return 'price'; |
| 15 |
} |
| 16 |
|
| 17 |
protected function _getSingleRowValue( PricingRule $pricingRule, $currentTierQuantity = null ): string { |
| 18 |
$product = wc_get_product( $pricingRule->getProductId() ); |
| 19 |
|
| 20 |
if ( $currentTierQuantity ) { |
| 21 |
$price = $pricingRule->getTierPrice( $currentTierQuantity, false ); |
| 22 |
|
| 23 |
if ( $price && $product ) { |
| 24 |
return wc_price( wc_get_price_including_tax( $product, array( |
| 25 |
'price' => $price, |
| 26 |
) ) ); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
return wc_price( wc_get_price_including_tax( $product ) ); |
| 31 |
} |
| 32 |
} |
| 33 |
|