Skip to main content
Solved

BigCommerce Integration: How to unmap variant price/weight from syncing?


hayleehicks
Varsity I
Forum|alt.badge.img

We have template items setup with matrix items that map to the BigCommerce variants. Client does not want price or weight to populate BigCommerce from Acumatica. They want to maintain that in BigCommerce only. I’ve set in both the Stock Item and Template Item entity to unmap these fields yet the variant in BigCommerce is updating the price/weight based on what is on the variant in Acumatica. Is there a better way to accomplish this? This is 22 R1 for reference.

 

Best answer by smarenich

@hayleehicks18 unfortunately, we still haven’t done ability to map Matrix Items and Variants. We will be working on it in the future versions.

However, now you can use this customization, if you want. It will unmap fields you have mentioned.

public class BCTemplateItemProcessorExt : PXGraphExtension<BCTemplateItemProcessor>
	{
		[PXOverride]
		public void Initialise(IConnector iconnector, ConnectorOperation operation, Action<IConnector, ConnectorOperation> baseHandler)
		{
			baseHandler(iconnector, operation);

			Base.GetType().InvokeMember("productvariantBatchProvider",
				System.Reflection.BindingFlags.SetField | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance,
				null, Base, new[] { new ProductVariantBatchRestDataProviderExt(BCConnector.GetRestClient(Base.GetBindingExt<BCBindingBigCommerce>())) });
		}
	}

	public class ProductVariantBatchRestDataProviderExt : ProductVariantBatchRestDataProvider
	{
		public ProductVariantBatchRestDataProviderExt(IBigCommerceRestClient restClient) : base(restClient)
		{
		}

		public override void UpdateAll(List<ProductsVariantData> productDatas, Action<ItemProcessCallback<ProductsVariantData>> callback)
		{
			foreach(ProductsVariantData variant in productDatas)
			{
				variant.Price = null;
				variant.Weight = null;
				variant.CostPrice = null;
				variant.RetailPrice = null;
				variant.SalePrice = null;
			}

			base.UpdateAll(productDatas, callback);
		}
	}

 

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

11 replies

smarenich
Acumatica Moderator
Forum|alt.badge.img+3
  • Acumatica Commerce Edition Team Lead
  • 227 replies
  • Answer
  • August 17, 2022

@hayleehicks18 unfortunately, we still haven’t done ability to map Matrix Items and Variants. We will be working on it in the future versions.

However, now you can use this customization, if you want. It will unmap fields you have mentioned.

public class BCTemplateItemProcessorExt : PXGraphExtension<BCTemplateItemProcessor>
	{
		[PXOverride]
		public void Initialise(IConnector iconnector, ConnectorOperation operation, Action<IConnector, ConnectorOperation> baseHandler)
		{
			baseHandler(iconnector, operation);

			Base.GetType().InvokeMember("productvariantBatchProvider",
				System.Reflection.BindingFlags.SetField | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance,
				null, Base, new[] { new ProductVariantBatchRestDataProviderExt(BCConnector.GetRestClient(Base.GetBindingExt<BCBindingBigCommerce>())) });
		}
	}

	public class ProductVariantBatchRestDataProviderExt : ProductVariantBatchRestDataProvider
	{
		public ProductVariantBatchRestDataProviderExt(IBigCommerceRestClient restClient) : base(restClient)
		{
		}

		public override void UpdateAll(List<ProductsVariantData> productDatas, Action<ItemProcessCallback<ProductsVariantData>> callback)
		{
			foreach(ProductsVariantData variant in productDatas)
			{
				variant.Price = null;
				variant.Weight = null;
				variant.CostPrice = null;
				variant.RetailPrice = null;
				variant.SalePrice = null;
			}

			base.UpdateAll(productDatas, callback);
		}
	}

 


hayleehicks
Varsity I
Forum|alt.badge.img
  • Author
  • Varsity I
  • 113 replies
  • August 24, 2022

Hi @smarenich! Thanks for the code snippet. That worked. What would need to be added to that code snippet to also unmap the sync of sales categories? We don’t want sales categories to sync either as those should be maintained in BigCommerce. When I synced the template items, the sales categories in BC were wiped out. Any suggestions are appreciated. Thanks!


smarenich
Acumatica Moderator
Forum|alt.badge.img+3
  • Acumatica Commerce Edition Team Lead
  • 227 replies
  • August 24, 2022

@hayleehicks18  starting from 2022r1 sales categories are optional. You can just disable category sync in the entities and also remove default categories in the store preferences. 

This should disable category sync.


josh.fischer
Semi-Pro II
Forum|alt.badge.img+1
  • Semi-Pro II
  • 70 replies
  • October 4, 2023

@hayleehicks  and anyone else who finds this thread - just a heads up that in 2023R2 (release date - 10/5/23) Acumatica will begin supporting “Unmapping” specific data on variants. This use case that Haylee described will be supported in 23R2. Additionally, you’ll have the ability to map custom data to variants. 


darylbowman
Captain II
Forum|alt.badge.img+13

@smarenich - Any chance Acumatica wishes to provide the community with a similar code snippet for Shopify? 🙂


simonliang91
Acumatica Employee
Forum|alt.badge.img+1
  • Acumatica Employee
  • 79 replies
  • October 24, 2023

@darylbowman , you can try this code in 2022r2 and 2023r1:

public class SPTemplateItemProcessor_Extension : PXGraphExtension<PX.Commerce.Shopify.SPTemplateItemProcessor>
	{
		public static bool IsActive() => CommerceFeaturesHelper.ShopifyConnector;
		#region Event Handlers
		public delegate void MapVariantInventoryItemDelegate(SPTemplateItemEntityBucket bucket, MatrixItems local, InventoryItem localInventoryItem, ProductVariantData external);
		[PXOverride]
		public void MapVariantInventoryItem(SPTemplateItemEntityBucket bucket, MatrixItems local, InventoryItem localInventoryItem, ProductVariantData external, MapVariantInventoryItemDelegate baseMethod)
		{
			baseMethod(bucket, local, localInventoryItem, external);
			external.Price = null;
			external.OriginalPrice = null;
			external.Weight = null;
		}


		#endregion
	}


 


darylbowman
Captain II
Forum|alt.badge.img+13

Thank you! Would've taken me a very long time, if I got there.


kkeating24
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 91 replies
  • April 17, 2024

@KarthikGajendran - I’m testing 24R1 internally with some test data. 

Is the export mapping of Matrix Items fully baked, or are there still some missing pieces?  

I have an example where I synced some t-shirts to my shopify store and it pulled the Vendor Name ‘Xiangtan Apparel’: 

 

This name also shows up on my default Shopify Store Theme, when viewing online: 

 

I wanted to remove that from my online store viz, so I unmapped from both stock item and Template Item using this logic:

 

It does not seem to work.  Name still shows under Vendor (i.e. same as the first picture)

 


simonliang91
Acumatica Employee
Forum|alt.badge.img+1
  • Acumatica Employee
  • 79 replies
  • April 18, 2024

@kkeating24 , if you put «Unmap» in the mapping, connector will not export any value to the Vendor field, so the existing value will keep in Shopify side. 

You can manual remove it in Shopify side. 


hayleehicks
Varsity I
Forum|alt.badge.img
  • Author
  • Varsity I
  • 113 replies
  • August 26, 2024

Can anyone provide an update on if this functionality works in 24 R1? The code snippets do NOT work in 24 R1. Please advise.


kkeating24
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 91 replies
  • August 26, 2024

@hayleehicks - one thing i have noticed, is that if the value is already populated in Shopify/BC that adding the logic to UNMAP something doesn’t update the Store on the next sync...  You have to remove the value in the store and then going forward the logic will prevent it from being updated via the sync.

Are you seeing a different result?


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