Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionWe have a pretty tricky problem: We run a german Woocommerce shop. All prices are including 19% VAT. For Austria we have to calculate 20%, but the prices including VAT should be the same. This can be easily done using the woocommerce_adjust_non_base_location_prices filter.
Now comes the tricky part: Since Switzerland is not part of the EU, products are sold excluding VAT. If we set the VAT settings for Switzerland to 0%, it's not working anymore with the filter added. Example:
Product costs 100 EUR including 19% VAT.
German buyers pay 100 EUR including 16 EUR VAT Austrian buyers pay 100 EUR including 17 EUR VAT Buyers from Switzerland SHOULD pay 84 EUR (100 EUR - 16 EUR VAT), but the system calculates 100 EUR.
A quick and dirty workaround would be to exclude the filter for buyers from Switzerland. I tried:
add_action( 'woocommerce_checkout_update_order_review', 'vd_adjust_ch_prices', 0, 1 );
public function vd_adjust_ch_prices( $post_data ) {
if ( isset( $_POST['country'] ) && ! in_array( $_POST['country'], WC()->countries->get_european_union_countries() ) || ( ! isset( $_POST['country'] ) && ! in_array( WC()->checkout()->get_value('billing_country'), WC()->countries->get_european_union_countries() ) ) ) {
add_filter( 'woocommerce_product_is_taxable', '__return_false', 20 );
}
}
The snippet does not work, and don't know why. Any ideas?
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionWe have a pretty tricky problem: We run a german Woocommerce shop. All prices are including 19% VAT. For Austria we have to calculate 20%, but the prices including VAT should be the same. This can be easily done using the woocommerce_adjust_non_base_location_prices filter.
Now comes the tricky part: Since Switzerland is not part of the EU, products are sold excluding VAT. If we set the VAT settings for Switzerland to 0%, it's not working anymore with the filter added. Example:
Product costs 100 EUR including 19% VAT.
German buyers pay 100 EUR including 16 EUR VAT Austrian buyers pay 100 EUR including 17 EUR VAT Buyers from Switzerland SHOULD pay 84 EUR (100 EUR - 16 EUR VAT), but the system calculates 100 EUR.
A quick and dirty workaround would be to exclude the filter for buyers from Switzerland. I tried:
add_action( 'woocommerce_checkout_update_order_review', 'vd_adjust_ch_prices', 0, 1 );
public function vd_adjust_ch_prices( $post_data ) {
if ( isset( $_POST['country'] ) && ! in_array( $_POST['country'], WC()->countries->get_european_union_countries() ) || ( ! isset( $_POST['country'] ) && ! in_array( WC()->checkout()->get_value('billing_country'), WC()->countries->get_european_union_countries() ) ) ) {
add_filter( 'woocommerce_product_is_taxable', '__return_false', 20 );
}
}
The snippet does not work, and don't know why. Any ideas?
Share Improve this question asked Dec 27, 2019 at 18:05 user2516117user2516117 771 silver badge8 bronze badges1 Answer
Reset to default 0If I'm not mistaken ... Then all these settings with taxes and countries are in woocommerce in a box. You only need to configure it correctly.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744874559a4598469.html
评论列表(0条)