Small bug – Wrong currency in exported data
-
Based on the change log, the ShipStation plugin sends the currency together with the order data. However, this is done by calling the wrong function.
In file
class-wc-shipstation-api-export.php, methodWC_Shipstation_API_Export::request()contains the following line:$this->xml_append( $order_xml, 'CurrencyCode', get_woocommerce_currency(), false );Function
get_woocommerce_currency()returns the active currency, which may or may not be the same as the order currency. The call should be replaced with the following:
$this->xml_append( $order_xml, 'CurrencyCode', $order->get_currency(), false );Note
We received reports that ShipStation might not be able to process orders in multiple currencies. Interestingly, their service kind of worked anyway with such systems, because the order currency was not passed with the data. Based on our tests, it seems that, when orders were sent in different currencies, ShipStation assumed (incorrectly) that they were in the currency set for their client’s account, and carried on.We can’t say if that resulted in errors on ShipStation’s side, but it’s worth keeping this in mind, in case the owner of multi-currency shop encounters any issue.
Further improvements
It could be a good idea to introduce a filter while fetching the order to pass to ShipStation. That is, replacing:
$order = wc_get_order( $order_id );
With something like:
$order = apply_filters( 'woocommerce_shipstation_export_order', wc_get_order( $order_id ) );That will allow 3rd parties to intercept the order before its contents are send to ShipStation. This can come in handy, for example, when ShipStation expects data in a specific currency, but the order is in another (again, common in multi-currency sites).
Frankly, it’s surprising that such services still don’t include native multi-currency support, but, if they are going to stay like that, at least the filter can allow the integration to send them the data they expect.
The topic ‘Small bug – Wrong currency in exported data’ is closed to new replies.