Add further Twig template suggestions

Created on 10 September 2024, 8 months ago
Updated 12 September 2024, 8 months ago

Problem/Motivation

When trying to add further Twig template suggestions using HOOK_theme_suggestions_commerce_product_availability_product_availability_default_alter() theres a lack of variables:

So further variables should be added and/or some helpful default suggestions, like:
- variant bundle
- variant display mode
- ...?

Steps to reproduce

I think it make sense to have the product_variation entity available, at least its id.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

1.0

Component

Code (commerce_product_availability)

Created by

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

Comments & Activities

  • Issue created by @thomas.frobieter
  • 🇩🇪Germany Anybody Porta Westfalica

    Yeah I understand that from the themer perspective. Meanwhile the field is always attached to an entity.
    So I think we should do it like fields to it typically. If we used an id or the fully loaded object should be decided based on the fact, if we already have the loaded entity there, so we don't cause extra load, if not.

    Could you provide an example what's available for other (best core) fields? Also to find the best namings...

  • Assigned to Grevil
  • Updated the issue title and description.

  • 🇩🇪Germany Grevil

    So through $item->getEntity(); in viewElements, we can easily get the variation and the bundle, but the display mode is not that easy unfortunately...

    @thomas.frobieter, would that suffice? We could also pass any other variation variables if needed!

Production build 0.71.5 2024