Skip to content

Instantly share code, notes, and snippets.

@DGStefan
Last active March 30, 2022 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DGStefan/c677be096118c64e443db8a8a8ec54b9 to your computer and use it in GitHub Desktop.
Save DGStefan/c677be096118c64e443db8a8a8ec54b9 to your computer and use it in GitHub Desktop.
Fixed version of /ac-addon-woocommerce/classes/Column/Shoporder/Tax.php
<?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