tax

Setting a tax class based on specific coupon in Woocommerce

杀马特。学长 韩版系。学妹 提交于 2021-02-10 20:52:05
问题 This has been answered a while back but the filter is not working anymore. Not sure if it is deprecated or not. I am using both filters: woocommerce_product_tax_class woocommerce_product_get_tax_class My function looks like: function wc_diff_rate_for_user( $tax_class, $product ) { $tax_class = "Zero rate"; return $tax_class; } add_filter( 'woocommerce_product_tax_class', 'wc_diff_rate_for_user', 1, 2 ); How can I set a tax class based on specific coupon in Woocommerce? 回答1: Since Woocommerce

Set specific taxable shipping rate cost to 0 based on cart subtotal in WooCommerce

喜夏-厌秋 提交于 2021-02-10 12:49:28
问题 With following code I'm able for specific shipping rate method (here 'easypack_parcel_machines') to set the cost to 0, when cart subtotal is up to a specific amount (here 150 PLN) : function override_inpost_cost( $rates, $package ) { // Make sure paczkomaty is available if ( isset( $rates['easypack_parcel_machines'] ) ) { // Current value of the shopping cart $cart_subtotal = WC()->cart->subtotal; // Check if the subtotal is greater than 150pln if ( $cart_subtotal >= 150 ) { // Set the cost

Set specific taxable shipping rate cost to 0 based on cart subtotal in WooCommerce

守給你的承諾、 提交于 2021-02-10 12:47:57
问题 With following code I'm able for specific shipping rate method (here 'easypack_parcel_machines') to set the cost to 0, when cart subtotal is up to a specific amount (here 150 PLN) : function override_inpost_cost( $rates, $package ) { // Make sure paczkomaty is available if ( isset( $rates['easypack_parcel_machines'] ) ) { // Current value of the shopping cart $cart_subtotal = WC()->cart->subtotal; // Check if the subtotal is greater than 150pln if ( $cart_subtotal >= 150 ) { // Set the cost

Get separate Order's tax totals amounts with tax class

冷暖自知 提交于 2021-02-07 09:29:54
问题 I'm making personal a PDF invoice plugin for woocommerce. Some of our products has tax with Reduced rate (%8) or Standart rate (%18). For example, Product A = Reduced rate (%8), Product B = Standart rate (%18). I can get total of tax amount easily but I want to print with sperate tax total amounts with tax class . How to get total Reduced rate tax amount of an order? Also Standart rate. How can I echo them separately? 回答1: The Tax class is not registered anywhere in the order data… It's

Get separate Order's tax totals amounts with tax class

為{幸葍}努か 提交于 2021-02-07 09:29:01
问题 I'm making personal a PDF invoice plugin for woocommerce. Some of our products has tax with Reduced rate (%8) or Standart rate (%18). For example, Product A = Reduced rate (%8), Product B = Standart rate (%18). I can get total of tax amount easily but I want to print with sperate tax total amounts with tax class . How to get total Reduced rate tax amount of an order? Also Standart rate. How can I echo them separately? 回答1: The Tax class is not registered anywhere in the order data… It's

How to get order tax details and rates in WooCommerce?

安稳与你 提交于 2021-01-29 04:08:22
问题 I'm trying to get the tax percentage for a custom variable in a plugin from an order. Of course I could request a lot of data via $order-> get_ ... , but I cannot find a method to get the tax percentage (like for example '21' -> 21%). Anyone have an idea to make this simple? 回答1: You will have to get order tax item(s) which will give you an array of WC_Order_Item_Tax Objects which protected properties are accessible using WC_Order_Item_Tax available methods like: // Get the the WC_Order

How to get order tax details and rates in WooCommerce?

拜拜、爱过 提交于 2021-01-29 04:08:11
问题 I'm trying to get the tax percentage for a custom variable in a plugin from an order. Of course I could request a lot of data via $order-> get_ ... , but I cannot find a method to get the tax percentage (like for example '21' -> 21%). Anyone have an idea to make this simple? 回答1: You will have to get order tax item(s) which will give you an array of WC_Order_Item_Tax Objects which protected properties are accessible using WC_Order_Item_Tax available methods like: // Get the the WC_Order

Display tax amount based on specific tax class in WooCommerce variations

こ雲淡風輕ζ 提交于 2021-01-29 04:01:46
问题 I'm currently using a custom function to target a specific product and change the output of the price with and without tax on the product page. This currently works as intended for an individual product id, however trying to get this work for a specific tax_class instead with no avail add_filter( 'woocommerce_available_variation', 'tax_variation', 10, 3); function tax_variation( $data, $product, $variation ) { $product = wc_get_product(); $id = $product->get_id(); $price_excl_tax = wc_get

Conditionally change products tax class via hooks in WooCommerce

若如初见. 提交于 2021-01-28 08:56:50
问题 I have implemented a b2b area into my WooCommerce Shop about 18 months ago. Recently I have updated all plugins and wordpress itself. Switching the tax class on variable products doesn't work anymore. The code below worked so far, but stopped working. What am I missing? add_filter('woocommerce_product_get_price', 'switch_price', 99, 2); add_filter('woocommerce_product_variation_get_price', 'switch_price', 99, 2); function switch_price($price, $product){ if(isset($_COOKIE["customerType"])){ if