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

Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mglaman created an issue. See original summary.

mglaman’s picture

Status: Active » Needs review
jsacksick’s picture

Patch looks good to me!

jsacksick’s picture

Status: Needs review » Reviewed & tested by the community

  • mglaman committed 60f7da0 on 8.x-2.x
    Issue #3178599 by mglaman, jsacksick: Provide a computed field for...
mglaman’s picture

Status: Reviewed & tested by the community » Fixed

Merged!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.