1

How can I get VAT ID for my orders through SOAP API 2? The field name is vat_id and is visible in order addresses (Billing Address and Shipping Address) like below:

John Doe
Company Co.
Street 1
11111 City 
Poland
T: 99879879879 
NIP: 111-11-11-111

I use multishipping checkout. Is it possible to get it?

Part of salesOrderInfo response is below:

<shipping_address>
    <parent_id>81</parent_id>
    <address_type>shipping</address_type>
    <firstname>John</firstname>
    <lastname>Doe</lastname>
    <company>Company Co.</company>
    <street>Street 1</street>
    <city>City</city>
    <postcode>11111</postcode>
    <country_id>PL</country_id>
    <telephone>99879879879</telephone>
    <address_id>162</address_id>
</shipping_address>
<billing_address>
    <parent_id>81</parent_id>
    <address_type>billing</address_type>
    <firstname>John</firstname>
    <lastname>Doe</lastname>
    <company>Company Co.</company>
    <street>Street 1</street>
    <city>City</city>
    <postcode>11111</postcode>
    <country_id>PL</country_id>
    <telephone>99879879879</telephone>
    <address_id>161</address_id>
</billing_address>

It lacks vat_id.

4 Answers 4

1

In February I made a PR to the Magento Hackaton repo in order to add two new SOAP fields for including customer TAX/VAT and email:

https://github.com/magento/hackathon_january_2014/pull/38

To get the TAX/VAT number, You only have to add the following line in the "shoppingCartCustomerEntity" and "shoppingCartCustomerAddressEntity" WSDL entities inside app/code/core/Mage/Checkout/etc/wsdl.xml:

<element name="taxvat" type="xsd:string" minOccurs="0"/>

hope it helps you!

3
  • I only changed name to vat_id
    – mkutyba
    Commented Jun 23, 2014 at 7:34
  • We are closing the repository. This is the change that was in mentioned PR gist.github.com/piotrekkaminski/… Commented Dec 1, 2017 at 20:58
  • This is taxvat field on customer model! vat_id is on customer address model and it misses from api also Commented Feb 14, 2018 at 9:05
1

To get taxvat in salesOrderInfo response through SOAP API

you have to add this at line 276 in app/code/core/Mage/Sales/etc/wsdl.xml

<element name="taxvat" type="xsd:string" minOccurs="0" />

and this at line 278 in app/code/core/Mage/Sales/etc/wsi.xml

<xsd:element name="taxvat" type="xsd:string" minOccurs="0" />
1

In case someone is looking for the taxvat field - it is indeed missing from salesOrderInfo, but it exists in salesOrderList. I guess it's kind of an oversight from Magento API designers as salesOrderInfo is basically the detailed order information and generally contains more order data than salesOrderList (except for taxvat field).

0

Extending @empiricompany answer (don't have enough reputation to comment).

It's not recommended to modify core Magento files. Instead, create a custom module, especially that it will be a very simple module consisting of basically 1 file. In your custom module add the wsdl.xml file inside the /etc folder. In this file you can define the additional fields you want to have in each of the API types - if you want to have vat_id field in billing_address your file should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
    name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
    <types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
            <import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />          
            <complexType name="salesOrderAddressEntity">
                <all>
                    <element name="vat_id" type="xsd:string" minOccurs="0" />
                </all>
            </complexType>
        </schema>
    </types>
</definitions>

Additional notes:

  • Your wsdl.xml file will be merged with other wsdl.xml files from all the modules that have such file to build the actual WSDL.
  • The core Magento file your wsdl.xml will be merged with is located at app/code/core/Mage/Sales/etc/wsdl.xml. You can base on this file copying its fragments to avoid typos.
  • As these files are merged, you don't need the full XML from Mage_Sales model. You can add only the fragments you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.