Solved

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

  • 17 August 2022
  • 8 replies
  • 264 views

Userlevel 4
Badge

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.

 

icon

Best answer by smarenich 18 August 2022, 01:25

View original

8 replies

Userlevel 7
Badge +3

@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);
}
}

 

Userlevel 4
Badge

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!

Userlevel 7
Badge +3

@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.

Userlevel 6
Badge +1

@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. 

Badge +11

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

Userlevel 5
Badge +1

@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
}


 

Badge +11

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

@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)

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved