Support » Plugin: VAT MOSS Returns » ‘reduced’ VAT rate

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author bseddon

    (@bseddon)

    I’m struggling to see how that’s happening. If you look on line 105 of ./includes/meta-box.php you will see that the meta box stores the selected rate type with a key of ‘_moss_rate_type’. This value is returned by the function ‘vat_rate_type_to_use’ that can be found on line 22 of the same file.

    The function ‘vat_rate_type_to_use’ is used on line 351 of ./includes/integrations/class-edd.php. It is used to select the rate type name (standard, reduced, etc.) for each item associated with each purchase (assuming you are using the standard set of rate).

    If the rate type has been set for each product the it should be pulling the rate type name ‘standard’.

    Can you see the meta key ‘_moss_rate_type’ in the postmeta table for the post_id records assicated with the EDD download definitions? Does it read ‘standard’?

    The other point of potential failure is on line 306 of ./includes/class-integrations.php. The name reported is not strictly the name mentioned above. Instead it is a lookup of that name so that, for example, ‘standard’ is turned in to ‘Standard’.

    However, I don’t see this issue (I submitted on July 1st) and no one else has reported an issue since Martin and Garry commented on the post you reference.

    I am happy to try to figure out what may be wrong but as I can’t reproduce the issue I will need your input.

    tesmat

    (@tesmat)

    Hi! Thanks for looking into this so swiftly!

    Can you see the meta key ‘_moss_rate_type’ in the postmeta table for the post_id records associated with the EDD download definitions? Does it read ‘standard’?

    I don’t have access to the DB on the server, but I downloaded the latest backup from VaultPress (Jetpack), and for all products it has something like this:

    INSERT INTO wp_postmeta('meta_id','post_id','meta_key','meta_value') VALUES (xxx,xxx,'_moss_rate_type','standard');

    … so that seems to be okay.

    For what it’s worth: I’m using the ‘WooCommerce EU VAT Assistant’ plugin
    https://wordpress.org/plugins/woocommerce-eu-vat-assistant/
    for the other side of this equation.

    What else… I’m exporting in the format for the Belgian MOSS,
    and I had this warning for each of the countries in the upload:

    <ns2:IntervatWarning>
      <ns2:Code>MOSS_BAD_VATRATE</ns2:Code>
      <ns2:Description>moss.bad.vatRate</ns2:Description>
    </ns2:IntervatWarning>

    … which probably has to do with that type="REDUCED" in the XML file.

    (The upload was accepted, though. These were just warnings, no fatal errors.)

    • This reply was modified 6 months ago by tesmat.
    • This reply was modified 6 months ago by tesmat.
    • This reply was modified 6 months ago by tesmat.
    Plugin Author bseddon

    (@bseddon)

    Hi. You have me confused. In your orginal question you mention that you have used the ‘meta’ box on the right of a download to select the correct rate type to use and in the previous post you include an INSERT statement that shows the VAT MOSS meta key. This suggests you are using Easy Digital Download. On the other hand you mention that you are using the VAT plugin for WooCommerce.

    Can you let me know if you are using EDD or WooCommerce?

    Thanks

    Bill

    tesmat

    (@tesmat)

    Ah, I wondered what the EDD abbreviation was standing for 🙂

    Yes, I’m using WooCommerce. And on the ‘Edit product’ screen you set this “VAT MOSS Rate Type” in this box on the right (what I thought was called a meta box).

    Plugin Author bseddon

    (@bseddon)

    So it seems the WooCommerce integration class does not use VAT rate type added to a product by the meta box (I agree with you that they are called meta boxes).

    If you review line 526 of ./includes/integrations/class-wooc.php you will see that the implementation attempts to pull what the VAT MOSS plugin calls the ‘VAT Rate Type’ from an array element called ‘_tax_class’ of a variable called ‘$item_meta’ which is set by calling the WooCommerce function $order->get_item_meta( $item_id ) called on line 475 . In turn $order is set by calling wc_get_order( $payment_id ) on line 454.

    I think if you change ‘reduced’ at the end of line 526 it may solve your problem. My guess is that since the VAT MOSS plugin was written, how the tax class information is stored has changed (or was never really correct).

    If you are able to verify my guess I will update the plugin.

    Bill

    • This reply was modified 6 months ago by bseddon.
    tesmat

    (@tesmat)

    I think if you change ‘reduced’ at the end of line 526 it may solve your problem. My guess is that since the VAT MOSS plugin was written, how the tax class information is stored has changed (or was never really correct).

    Okay, I tried it. That seems to have an effect.

    The export file now contains:
    <VatRateType type="STANDARD">21.00</VatRateType>

    … but wouldn’t this change make all of them ‘Standard’ (also the ones that should be ‘Reduced’)? I could test it, but it’s a bit of a hassle.

    BTW, on the New Submission screen, the purchases still have ‘Reduced’ as their VAT type (but that’s because they already happened earlier I suppose)

    Ah, also. I didn’t check the export with new purchases (again, hassle, but I could do it if you want).

    I found something else. The local server, on which I tested, has define('WP_DEBUG', true);, and these warnings popped up:

    In the Meta box, on the Edit Product screen:
    Warning: Use of undefined constant VAT_GROUP_CLASS_REDUCED - assumed 'VAT_GROUP_CLASS_REDUCED' (this will throw an Error in a future version of PHP) in …/wp-content/plugins/vat-moss/includes/meta-box.php on line 25

    On the New Submission screen, once for every item in the list:
    Notice: WC_Order::get_item_meta is deprecated since version 3.0! Use wc_get_order_item_meta instead. in …/wordpress/wp-includes/functions.php on line 4435
    (but that’s not in my functions.php, it isn’t that long)

    And, most importantly, I discovered one more thing: I can’t change a product’s ‘VAT MOSS Rate Type’ (the Meta box) to anything else than ‘Standard’ (the first in the list). When I change it to ‘Reduced’ and save, it keeps being ‘Standard’

    • This reply was modified 6 months ago by tesmat.
    • This reply was modified 6 months ago by tesmat.
    Plugin Author bseddon

    (@bseddon)

    Hi

    The mistake was to make the metabox available to WooCommerce users. The VAT plugin for EDD does not automatically add a label for the VAT rate type to the purchase but the plugin for WooCommerce does. The VAT MOSS plugin compenstates for the omission by the EDD VAT plugin but also make it available from within WooCommerce. This is not correct.

    The VAT plugin for WooCommerce adds a meta value to each purcahse which is held in a field called ‘_tax_type’. This is the value retrieved on line 295 of ./includes/integrations/class-wooc.php. To affect the tax rate type for each product you will need to use the relevant feature supplied by the WooCommerce VAT plugin.

    I will update the code to return a default value of ‘standard’ not ‘reduced’ and to prevent the metabox appearing for WooCommerce shop admins. Preventing the metabox appearing will eliminate the warning ‘Use of undefined constant VAT_GROUP_CLASS_REDUCED’.

    At the moment the default value is being used on line 295. Currently this is ‘reduced’ and should be ‘standard. My guess is that the default value is being used because _tax_type field is empty if the standard rate applies though it could be that the location of this value within the WooCommerce purchase record has changed since the VAT MOSS plugin was first weritten.

    When I have an opportunity I’ll take a more detailed look. The will allow me to look at the isse with the call to a deprecated method and to review how the _tax_type value is stored.

    In the meantime you should be able to stick with the change you made today.

    Regards

    Bill

    tesmat

    (@tesmat)

    The VAT MOSS plugin compensates for the omission by the EDD VAT plugin but also make it available from within WooCommerce.

    Yeah, I was wondering why you have to set the tax rate in two places on the same screen.

    When I have an opportunity I’ll take a more detailed look. The will allow me to look at the issue with the call to a deprecated method and to review how the _tax_type value is stored.

    Great!

    In the meantime you should be able to stick with the change you made today.

    True. I’m only selling stuff at the standard rate (obviously), so the export currently works fine.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘‘reduced’ VAT rate’ is closed to new replies.