Skip to main content

How-To: Update external shipping info during Order Import Using Shopify Connector

  • January 6, 2021
  • 1 reply
  • 257 views

simonliang91
Acumatica Employee
Forum|alt.badge.img+1

The current Acumatica Shopify Connector doesn’t process the shipping information during Sales Order Import. But in some cases, Shopify Order will be fulfilled by other 3rd party service, and you want to import the shipping information into Acumatica Order if the order has been fulfilled. 

This request can be resolved by using customization project:

namespace PX.Commerce.Shopify
{
	public class SPSalesOrderProcessor_Extension : PXGraphExtension<SPSalesOrderProcessor>
	{
		public delegate void SaveBucketImportDelegate(SPSalesOrderBucket bucket, IMappedEntity existing, String operation);

		[PXOverride]
		public virtual void SaveBucketImport(SPSalesOrderBucket bucket, IMappedEntity existing, String operation, SaveBucketImportDelegate baseMethod)
		{
			//Local is the API Object from Acumatica
			SalesOrder localOrder = bucket.Order.Local;

			//Extern is the API Object from Shopify
			OrderData externOrder = bucket.Order.Extern;

			//You can check FulfillmentStatus and Fulfillments object to ensure order has fulfillment data
			//If order is unfulfilled, externOrder.Fulfillments is null
			if ((externOrder.FulfillmentStatus == OrderFulfillmentStatus.Fulfilled || externOrder.FulfillmentStatus == OrderFulfillmentStatus.Partial) 
				&& externOrder?.Fulfillments?.Count > 0)
			{
				//Process the fulfillment data as what you want
				foreach(FulfillmentData fulfillmentItem in externOrder?.Fulfillments)
				{
					if(fulfillmentItem.Status == FulfillmentStatus.Success) //You can handle data based on each fulfillment item status
						localOrder.Note += $"Tracking Company: {fulfillmentItem.TrackingCompany}, tracking number: {string.Join(",",fulfillmentItem.TrackingNumbers)}";
				}
			}

			baseMethod(bucket, existing, operation); // calling the base met
		}
	}
}

Now the shipping information will be auto updated to “Notes” field in Acumatica Order. 

 

 

Did this topic help you find an answer to your question?

1 reply

apretorius62
Freshman I
Forum|alt.badge.img
  • Freshman I
  • 36 replies
  • October 12, 2022

Hi Simon

Does the customization actually ship the Acumatica order too?

I have a customer who’s orders will be delivered by a third party and they update shopify.

My intention then is to fetch the fulfillment and ship the order.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings