Skip to content

Coupon code empty after update of sales rule through rest #35298

Closed
@websecureNL

Description

@websecureNL

Preconditions (*)

1.Magento ver. 2.4.3

Steps to reproduce (*)

  1. Create a new disabled Cart Price Rule through API - endpoint POST: /rest/V1/salesRules/

Sample payload
{"rule":{"name":"This is the coupon name","store_labels":[{"store_id":0,"store_label":"Gift Card $20"}],"website_ids":[1],"customer_group_ids":[0],"from_date":"","to_date":"","uses_per_customer":0,"is_active":false,"stop_rules_processing":true,"is_advanced":true,"simple_action":"cart_fixed","discount_amount":20,"discount_qty":0,"discount_step":0,"apply_to_shipping":false,"is_rss":false,"coupon_type":"SPECIFIC_COUPON","use_auto_generation":false,"uses_per_coupon":0}}

  1. Create a new Coupon for newly created sales rule through API - endpoint POST: /rest/V1/coupons/

Sample payload
{"coupon":{"rule_id":insert rule_id,"code":"GC1-FD2SD","usage_limit":0,"usage_per_customer":0,"times_used":0,"is_primary":true,"type":0,"extension_attributes":{}}}

  1. Update the status of the Cart Price Rule to enabled through Cart Price Rule through API - endpoint PUT /rest/V1/salesRules/{rule_id}

Sample payload
{"rule":{"name":"New Name","from_date":"2022-01-01","to_date":"2022-10-10","is_active":true}}

Expected result (*)

  1. Expected that only updated values would be applied (existing Cart Price Rule got a status change from disabled to enabled with a from_date and to_date) and that the existing coupon code would still be attached.

Actual result (*)

  1. After updating the Cart Price Rule the coupon code is removed from the rule.

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: APIsComponent: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Component: SalesRuleIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: doneReported on 2.4.3Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions