FosterCommerce / shipstation-connect

A plugin for Craft Commerce 2 that integrates with ShipStation.
https://plugins.craftcms.com/shipstationconnect
Other
7 stars 10 forks source link

Errors when syncing orders without Country Code #19

Closed brettburwell closed 3 years ago

brettburwell commented 4 years ago

Hi y'all. After updating to version 1.3.2 of the plugin we're now seeing errors in the XML feed when syncing orders in ShipStation.

The issue seems to be related to the fact that we're passing orders to ShipStation that don't have any address info associated with them (our client pivoted to a curbside pickup model when COVID hit).

Obviously these curbside pickup orders don't need to be passed to ShipStation to begin with, but as far as I can tell there isn't a way to configure the plugin to send some orders to ShipStation, but not others. If that's possible and I'm missing something, let me know.

Here's the specific error we're seeing (that sounds similar to what's happening in #18):

An error occurred attempting to update orders: Error in XML. Reason: The 'Country' element is invalid - The value '' is invalid according to its datatype 'StringExactly2' - The actual length is less than the MinLength value.

I was able to temporarily get things back up and running by editing line 443 of the services/Xml.php file to be:

return $address->countryId ? $address->getCountry()->iso : 'US';

Obviously not a long term fix, but perhaps there's a way to pass along a default in the ternary operator that doesn't cause the feed to break.

If there's any other info I can pass along that'd be helpful let me know. And thanks in advance!

System Info

brettburwell commented 4 years ago

Hi y'all. Just checking in to see if you might have any updates to pass along on this one? Thanks.

johnnynotsolucky commented 3 years ago

Hi @brettburwell ShipStation requires the country code unfortunately.

If you don't need the curbside orders to be synchronized to ShipStation, you can use the store field:

image

Add it to the order fields

image

Set the field in ShipStation Connect settings:

image

After this you can get the correct URL for each store to synchronize orders. You can then configure ShipStation to fetch just the orders from the store which you intend to ship.

To put an order in a particular store set the value of the field in the order:

image

brettburwell commented 3 years ago

Hi @johnnynotsolucky. Thanks for the detailed followup. That super helpful and much appreciated.