Guest User

Untitled

a guest
Apr 19th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. round( reset( WC_Tax::get_rates() )['rate'] )
  2.  
  3. // Function to add shortcode to display tax rates
  4. function woocommerce_template_display_tax() {
  5. global $product;
  6. $tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
  7. if (!empty($tax_rates)) {
  8. $tax_rate = reset($tax_rates);
  9. echo sprintf(_x('Price without %.2f %% tax', 'Text for tax rate. %.2f =
  10. tax rate', 'wptheme.foundation'), $tax_rate['rate']);
  11. }
  12. }
  13. add_shortcode('display_tax', 'woocommerce_template_display_tax');
Add Comment
Please, Sign In to add comment