Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bo Jacobsen 606 posts 2404 karma points
    Sep 14, 2021 @ 14:09
    Bo Jacobsen
    0

    VENDR deleted regions still exists

    Hi Matt.

    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.

    Is it a bug or is there a workaround?

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 14, 2021 @ 14:46
    Matt Brailsford
    0

    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

  • Bo Jacobsen 606 posts 2404 karma points
    Sep 15, 2021 @ 06:40
    Bo Jacobsen
    0

    Hi Matt.

    We are using VENDR version 1.8.2.

    We will try out the demo store and report back.

  • Bo Jacobsen 606 posts 2404 karma points
    Sep 15, 2021 @ 10:20
    Bo Jacobsen
    0

    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.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 15, 2021 @ 10:26
    Matt Brailsford
    0

    Ok great, thanks for confirming this. I'll run through the steps and see what is going on 👍

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 20, 2021 @ 08:41
    Matt Brailsford
    100

    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

Please Sign in or register to post replies

Write your reply to:

Draft