Skip to content

Discount rule provider settings does not show the correct description #772

@MiguelLopez6

Description

@MiguelLopez6

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)

16.3.1

Bug summary

I am creating a custom OrderLineDiscountRuleProviderBase, and adding custom settings using the DiscountRuleProviderSetting attribute. I am able to add all related properties to the attribute (label, description, editor ui alias), but on the front end it seems the setting always renders the description with the same text as the label.

Specifics

This is a snippet of the discount rule provider:
`
[DiscountRuleProvider("customRule",
Label = "Custom Rule",
Description = "Custom description")]
public class CustomDiscountRuleProvider : OrderLineDiscountRuleProviderBase
{
private readonly IProductContentService _productContentService;

public CustomDiscountRuleProvider(UmbracoCommerceContext ctx) : base(ctx)
{}

public override DiscountRuleResult ValidateRule(DiscountRuleContext ctx, CustomDiscountRuleProvider settings)
{
    // ...
}

}

public class CustomSettings
{

[DiscountRuleProviderSetting(
    Key = "settingKey",
    Label = "Setting Label",
    Description = "Setting Description")]
public string? SettingValue { get; set; }

}
`

The description of the DiscountRuleProviderSetting attribute seems to not work:

Image

Steps to reproduce

Create a new OrderLineDiscountRuleProviderBase, add the settings object with a property decorated with the attribute DiscountRuleProviderSetting, adding a label and description (different from the label) to the attribute.
Go to the backoffice and add a discount using the new discount rule.
Check the discount rule configuration shows the setting property with the same label and description.

Expected result / actual result

It should render the label "Setting Label" and the description "Setting Description", but it renders both the label and description as "Setting Label"

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