How to get a field value and multiply it to get price in a PriceResolver
I was able to get this to work by checking that field_discount_percentage is not empty, rather than just checking if the entity has field_discount_percentage. The error must have been from all the other entities that were returning empty fields as a non-numerical value of &quot;&quot;
public function resolve(PurchasableEntityInterface $entity, $quantity, Context $context) {
  if ($entity instanceof ProductVariationInterface &amp;&amp; !$entity-&gt;get('field_discount_percentage')-&gt;isEmpty()) {
     $discount = $entity-&gt;get('field_discount_percentage')-&gt;getValue()[0]['value'];
     return $entity-&gt;getPrice()-&gt;multiply($discount);
  }
}