I have two questions: The first one is that I want to get the interest rate on percent of each order item in woocommerce using this code:
$items = $order->get_items();
if ($items) foreach ($items as $item_key => $item_value) {
$_tax = new WC_Tax();
$_product = $order->get_product_from_item( $item_value );
$product_tax_class = $_product->get_tax_class();
$tax = $_tax->get_rates($product_tax_class);
The result is empty, so I don’t know what is wrong with the code.
Secondly, the standard rate is always displayed as an empty task class. This may confuse a single tax product. Something is wrong?
source
share