Get the tax identification options of the client group in Magento2

Recently I built a page that allows the user to create a group of customers from a custom module. I have a drop-down menu in the front-end that retrieves a list of tax classes and identifiers. I just realized that I have the wrong classes and I have the product tax classes:

public function getTaxClasses(){
        $taxClasses = $this->productTaxClassSource->getAllOptions();
        foreach($taxClasses as $t){
            echo "";
        }
    }

Instead of using productTaxClassSource, is there a collection or list where you can get the options for CLIENT GROUP TAX CLASSES, which are found in customers-> customer groups-> tax class? Or can someone point me to the table where I can find that information if I have to make a selection?

php – Show price with and without TAX depending on user role

The base price of my store includes TAXES. What I am trying to do is show the price of some user roles with and without TAX, and for other user roles, I want to show only prices without TAX.

I tried using the "price display suffix" field and hiding unwanted items with display: none, but it can't be done due to the html structure I get.

Now I am trying to use woocommerce_get_price_html where I verify the user role and then turn off taxes for specific roles, although I don't know if it's safe and it still doesn't work as I want.

function tax_price_based_on_role( $price ) {
    $current_user = wp_get_current_user();
    $allowed_roles = array( 'user_role1', 'user_role2' );
    if ( is_user_logged_in() && array_intersect( $current_user->roles, $allowed_roles ) ) {
        WC()->customer->set_is_vat_exempt( true );
        //need to also show price with TAX
        return $price .= ' ' . __('without TAX');
    }
    else{
        return $price .= ' ' . __('with TAX');  //show only price with TAX
    }
}
add_filter( 'woocommerce_get_price_html', 'tax_price_based_on_role' );

I only managed to show the price with TAXES to a role and a price without taxes to the role of another user. I tried to add taxes to $price, but failed because it contains price chain and currency. Maybe there is a better way to do this?

Why do conservatives oppose large tax increases so much?

"The modern conservative is engaged in one of the oldest exercises of man in moral philosophy; that is, the search for a superior moral justification for selfishness." John Kenneth Galbraith

"Socialism never took root in the United States because the poor do not see themselves as an exploited proletariat but as temporarily ashamed millionaires."

"Although it is not true that all conservatives are stupid people, it is true that most stupid people are conservative." John Stuart Mill

Woocommerce: the same gross price for different tax rates

We have a rather complicated problem: we have a German Woocommerce store. All prices include 19% VAT. For Austria we have to calculate 20%, but the prices with VAT included should be the same. This can easily be done using the woocommerce_adjust_non_base_location_prices filter.

Now comes the difficult part: since Switzerland is not part of the EU, the products are sold without VAT. If we set the VAT setting for Switzerland at 0%, it no longer works with the filter added. Example:

The 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.
Swiss buyers MUST pay EUR 84 (EUR 100 – EUR 16 VAT), but the system calculates EUR 100.

A quick and dirty solution would be to exclude the filter for Swiss buyers. 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 fragment doesn't work, and I don't know why. Any ideas?

wp query: custom tax queries generated by Foreach, each with an ajax "Load more" button

I'm going through custom taxonomy terms to create a WP_Query for each term, and then view the posts in the front-end.

I am also trying to adapt this useful tutorial (and the accompanying comments) to add an ajax load more button to each loop iteration. This is what I think distinguishes this problem from other publications in WP-StackExchange: add a more load button to a loop query, instead of a single query or simply multiple WP_Query encoded (not loop) on a page.

The original tutorial uses wp_localize_script to pass php data to a registered and queued jQuery script, but since I need unique variables created with each loop, it didn't seem like he could use it (and the author of the tutorial himself says not to use wp_localize_script if you use a custom WP_Query). The comments in that post also refer to the use of unique variables for multiple queries, but I couldn't resolve it for looped queries.

The button that is included in each iteration of the loop:

// don't display the button if there are not enough posts
if (  $unique_query->max_num_pages > 1 )
    echo '';

I realize that the following code is not as concise as it could be yet (hence why I am here), but I include in each foreach query & # 39; d the same jQuery to be able to create unique query vars for each loop (it is tell, . current_page_):

The jQuery included at the end of each loop iteration:

$cat_string = the current taxonomy term string, that is. los_angeles


Ajax action loadmore it's hooked on my functions.php like this:

function bos_loadmore_ajax_handler(){

    // prepare our arguments for the query
    $args = json_decode( stripslashes( $_POST('query') ), true );
    $args('paged') = $_POST('page') + 1; // we need next page to be loaded
    $args('post_status') = 'publish';

    // it is always better to use WP_Query but not here
    query_posts( $args );

    if( have_posts() ) :

        // run the loop
        while( have_posts() ): the_post();

            get_template_part( 'template-parts/event', 'small' ); 

        endwhile;

    endif;
    die; // here we exit the script and even no wp_reset_query() required!
}

add_action('wp_ajax_loadmore', 'bos_loadmore_ajax_handler'); // wp_ajax_{action}
add_action('wp_ajax_nopriv_loadmore', 'bos_loadmore_ajax_handler'); // wp_ajax_nopriv_{action}

Unique query vars create instances and complete correctly: I can see the correct result for each tax term cycle in the Inspector.

The "Load more" button is displayed correctly since the query has 26 posts and shows 20, but when I click on the button it changes to "Loading …" and then disappears. Of some console.logIt seems that it jumps directly to the else branch for "no data was found", so I think that the action hooked in my function file is not getting the correct query values ​​to execute the query. Does that seem correct?

However, I cannot understand how the query variables should be different to get the correct query.

And to be exhaustive, the $ args WP_Query for each loop query are:

$paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
$args = array(
    'post_type'              => array( 'tribe_events' ),
    'post_status'            => array( 'publish' ),
    'posts_per_page'         => 20,
    'nopaging'               => false,
    'paged'                  => $paged,
    'tax_query'              => array(
        array(
            'taxonomy'         => 'tribe_events_cat',
            'field'            => 'name',
            'terms'            => $the_cat,
        ),
    ),
);

Any help is really appreciated.

Mexico – How does the Baja California Sur sustainability tax work?

When flying to the San Jose del Cabo airport, they gave me a flyer about a new sustainability tax. According to the LA Times:

Travelers arriving at Los Cabos International Airport will be asked for around $ 18 (350 pesos) each as of Saturday. But local officials say this is not a tax. It is a request for a voluntary contribution to benefit a new Fund for a Sustainable Baja California Sur.

Under the new program, authorities said, the San José del Cabo airport will have kiosks that will encourage visitors to contribute to the kiosk or through online payments.

The article then mentions that it is a voluntary tax (?):

Isidro Jordán Moyrón, secretary of finance for the State of Baja California Sur, said in a prepared statement that the new effort is not an "entry tax" and that "visitors will not be forced or unduly forced to make a contribution."

Is it really voluntary? Is there a penalty for not paying this tax?

event observer – Magento 1.9: get the tax value of the order parameters when the payment method is paypal express

In my Magento 1.9 project there is an observer to obtain the tax value of the order at the place of the previous order. But when the payment method selected is paypal express, Mage :: app () -> getRequest () -> getParams () has no taxvat field, but only payerid and token.
How can I get the tax value of the order when the payment method is Paypal Express?
Bye thank you

Magento2: show prices including TAX Magento 2.3?

Battery exchange network

The Stack Exchange network consists of 175 question and answer communities, including Stack Overflow, the largest and most reliable online community for developers to learn, share their knowledge and develop their careers.

Visit Stack Exchange

variables – Woocommerce; Tax status for product variations?

I realized that by creating a new variable product in Woocommerce and setting the tax status of the main product at & # 39; none & # 39 ;, the variations still show: & # 39; tax status: taxable & # 39; in the database. Does anyone know what determines the value of the tax status of product variations?
As in another installation, I have variable products where the main product shows & # 39; tax status: taxable & # 39; and product variations show: & # 39; tax status: none & # 39 ;. In the front-end, the tax is calculated for variations, although …

Thank you.

Where is the tax exemption located at Mariehamn airport?

I recently flew from Mariehamn to Stockholm, but I couldn't find the free tax. When reading about the airport, I discovered that it is actually exempt from the EU VAT area and that the tax exemption is tax exempt (not as in other EU airports on EU flights), even when flying to Sweden or Finland!

Where can I find the free tax at Mariehamn airport?