Tag is not added to the page if both node and commerce product are selected in conditions

Created on 28 June 2024, 9 months ago

Problem/Motivation

If you configure conditions for node and commercial product in the tag settings, the tag will not be added to both of them.
If only a product or a node is configured, the tag is attached to the page of the corresponding entity.
I was able to reproduce this issue on a clean Drupal (10.2.7) installation with google_tag (2.0.5) and commerce modules installed.

The problem is in passesConditions() method of TagContainerResolver class, on the node page it gets MissingValueContextException for commerce_product context and on the product page the same exception occurs but for node context.
During debugging I've found out that on the node page the ProductRouteContext can't get product from route and on the product page NodeRouteContext can't get node from the route.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ΎBelarus kachinsky

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kachinsky
  • πŸ‡¨πŸ‡¦Canada dshields

    This seems to also be the case when a condition is added in "Request path" as well as "Webform". Could it be that any combination of conditions breaks the logic?

  • πŸ‡ΊπŸ‡ΈUnited States jwag956 Monterey, ca

    This also happens when setting restrictions on content-type - then views (request path) no longer get tagged.
    The passesConditions logic seems to be implementing an 'and' condition - as in ALL configured conditions have to pass - so this feels like are larger issue in how conditions are evaluated and in which context.
    This is drupal 10.4 and GT 2.0.8

Production build 0.71.5 2024