Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
We have the getDefaultVariation
method on products. Having that exposed a computed field would be useful when using Commerce over JSON:API
For example, if you use ?include=variations
you'll get all variations which could be 1,2, or 50. When it is larger it makes a catalog query much more expensive. The ?include=default_variation
creates a lighter request.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork commerce-3178599
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mglamanComment #4
jsacksick CreditAttribution: jsacksick at Centarro commentedPatch looks good to me!
Comment #5
jsacksick CreditAttribution: jsacksick at Centarro commentedComment #7
mglamanMerged!