We create countries and regions through the vendrapi like
using (var uow = _vendrApi.Uow.Create())
{
var region = Region.Create(uow, store.Id, country.Id, code, name);
_vendrApi.SaveRegion(region);
uow.Complete();
}
And that works.
But if we then delete some or all the regions from the country setting at like /umbraco/#/settings/vendrsettings/country-edit/2dee6bf4-fd58-424e-ae2d-7af3e23de7fe_dd5f5c1d-be9b-40fa-bbc2-5bb99b21657a and call the shipping method like this
var shippingMethod = _vendrApi.GetShippingMethod(shippingId);
if(shippingMethod != null)
{
foreach(var allowedCountryRegion in shippingMethod.AllowedCountryRegions)
{
// shippingMethod.AllowedCountryRegions contains all ever created regions.
}
}
then the list of AllowedCountryRegions contains every region we ever created.
Hmm, it should indeed handle the cleanup. When the country / region is being deleted, Vendr will raise an internal event that it's being removed and we have a number of handlers that should be cleaning this up for various entities, including currencies, payment methods and shipping methods.
We have now testet it with the demo shop and here we got the same issue.
The easiest way to replicate this is to manuelly create a region or more and allow them to be used on the shipping method. Then go back to region and delete them and then try to run shippingMethod.AllowedCountryRegions and it will contains all those region who where allowed before deleting them.
VENDR deleted regions still exists
Hi Matt.
We create countries and regions through the vendrapi like
And that works.
But if we then delete some or all the regions from the country setting at like
/umbraco/#/settings/vendrsettings/country-edit/2dee6bf4-fd58-424e-ae2d-7af3e23de7fe_dd5f5c1d-be9b-40fa-bbc2-5bb99b21657a
and call the shipping method like thisthen the list of AllowedCountryRegions contains every region we ever created.
Is it a bug or is there a workaround?
Hi Bo,
Hmm, it should indeed handle the cleanup. When the country / region is being deleted, Vendr will raise an internal event that it's being removed and we have a number of handlers that should be cleaning this up for various entities, including currencies, payment methods and shipping methods.
What version of Vendr are you using? Can you confirm this with the demo store codebase? https://github.com/vendrhub/vendr-demo-store
If you can replicate the error in the demo store then it sounds like it may be a bug, but if not, it may be in your implementation.
Matt
Hi Matt.
We are using VENDR version 1.8.2.
We will try out the demo store and report back.
Hi Matt.
We have now testet it with the demo shop and here we got the same issue.
The easiest way to replicate this is to manuelly create a region or more and allow them to be used on the shipping method. Then go back to region and delete them and then try to run
shippingMethod.AllowedCountryRegions
and it will contains all those region who where allowed before deleting them.Ok great, thanks for confirming this. I'll run through the steps and see what is going on 👍
Hi Bo,
I'll try and take a look at this later in the week, but given this is a bug, I've added it to our issue tracker here https://github.com/vendrhub/vendr/issues/321
I'll keep you updated with progress.
Matt
is working on a reply...