Problem/Motivation

field_cost field name is hardcoded in the module. And it breaks if an order item doesn't have a field called field_cost.

Steps to replicate:

  • Create a Commerce promotion with offer Set price to cost plus a percentage
  • Make sure that the promotion should be applied for a product
  • Add the product to cart

You will see error:

The website encountered an unexpected error. Please try again later.Drupal\Core\Entity\EntityStorageException: Field field_cost is unknown. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 829 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php)

Proposed resolution

Either add a trait that will add the field_cost #2944570: Provide cost fields as traits. Or find a way to unhardcode the usage of the field.

Remaining tasks

TBD

User interface changes

N/A

API changes

TBD

Data model changes

TBD

Comments

subhojit777 created an issue. See original summary.

subhojit777’s picture

travis-bradbury’s picture

StatusFileSize
new1.02 KB
travis-bradbury’s picture

StatusFileSize
new692 bytes

Bah, didn't want that composer.json change.

  • tbradbury committed 1b285cb on 8.x-1.x
    Issue #2962798 by tbradbury, subhojit777: Do not hardcode field...
travis-bradbury’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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