Skip to content

Dynamic Priced Shipping Method causing a NRE when updating order #787

@Rian-BG

Description

@Rian-BG

Which component is this issue related to?

Umbraco Commerce (Core)

Which Umbraco Commerce version are you using? (Please write the exact version, example: 10.1.0)

13.2.2

Bug summary

When selecting a Dynamic Shipping Method configured purely via the back office (no custom calculator code), checkout fails with a NullReferenceException.
Flat-rate shipping methods work without issue — only dynamic shipping methods trigger the error.

Code being called:

_commerceApi.Uow.Execute(uow =>
            {
                var store = _settingsService.GetStore();
                var order = _commerceApi.GetOrCreateCurrentOrder(store.Id)
                    .AsWritable(uow)
                    .SetShippingMethod(shippingMethodId);

                _commerceApi.SaveOrder(order);

                uow.Complete();
            });

Specifics

  • No custom shipping calculator implemented
  • Dynamic rate created according to official documentation
  • Order currency & shipping address present and valid
  • ShippingMethodId is correctly assigned to the order on update
  • Only difference between working and failing shipping methods: Dynamic vs Flat

Steps to reproduce

  1. Create a Dynamic Shipping Method via back office:

Add valid pricing rules/bands
Save & publish

  1. Add product to cart and proceed to checkout
  2. Select the Dynamic Priced Shipping method and submit form/trigger update of order shipping method/continue with checkout flow
  3. NRE thrown during _api.SaveOrder(order)

Expected result / actual result

Expected Result
Order is updated with the correct shipping method and pricing, and no errors are thrown/checkout flow continues as expected

Actual Result
A NullReferenceException is thrown when updating the shipping method

Dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions