Skip to content

The 'promotion' region of the minicart is never rendered #25373

Closed
@mattijv

Description

@mattijv

Preconditions (*)

  1. M2.3.1 or later (and possibly some later M2.2 versions too)

Steps to reproduce (*)

  1. Add a component to the 'promotion' region of the minicart jsLayout

Expected result (*)

  1. Component is rendered

Actual result (*)

  1. Component is not rendered

Cause

The issue was introduced in #20383 where an if-binding was added to the minicart-widgets div to prevent the div from being rendered if the 'promotion' region does not contain any elements. Unfortunately the if was written badly as the conditional is checking the length property of the observable returned from getRegion (always 0) instead of the array contained in the observable. This means the conditional is always false and the element is never rendered.

Possible fixes

I've create two mutually exclusive PR's that solve the issue in two ways.

#25374 Fixes the if-clause by adding the missing parentheses.

#25375 Is a bit more involved fix as it adds a separate method to the collection component that can be used to check if a region contains elements. It also modifies existing uses of the getRegion(region)().length pattern to use the new method.

Metadata

Metadata

Assignees

Labels

Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Format is validGate 1 Passed. Automatic verification of issue format passed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions