Last active
March 30, 2022 06:47
-
-
Save DGStefan/c677be096118c64e443db8a8a8ec54b9 to your computer and use it in GitHub Desktop.
Fixed version of /ac-addon-woocommerce/classes/Column/Shoporder/Tax.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace ACA\WC\Column\ShopOrder; | |
use AC; | |
use ACA\WC\Search; | |
use ACP\Export; | |
/** | |
* @since 3.6 | |
*/ | |
class Tax extends AC\Column implements Export\Exportable { | |
public function __construct() { | |
$this->set_type( 'column-wc-order_tax' ) | |
->set_label( __( 'Tax', 'codepress-admin-columns' ) ) | |
->set_group( 'woocommerce' ); | |
} | |
public function get_value( $id ) { | |
$taxes = wc_get_order( $id )->get_tax_totals(); | |
if ( empty( $taxes ) ) { | |
return $this->get_empty_char(); | |
} | |
$result = []; | |
foreach ( $taxes as $tax ) { | |
$result[] = sprintf( '<small><strong>%s: </strong></small> %s', $tax->label, $tax->formatted_amount ); | |
} | |
return implode( '<br>', $result ); | |
} | |
public function export() { | |
return new Export\Model\StrippedValue( $this ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment