0

A customer want to have the possibility to use different discounts on products. I'm working with the price resolver and I'll give the possibility to manage different discounts with taxonomy terms. I added an entity reference field (field_discount) to the product.

I'm writing the module that should look which discount is given to the product and then calculate the price based on the discount.

How can I load the value of field_discount in my module?

I made now a lot of research and I tried many different things, but nothing worked.

0

Have you tried?

$product->get('field_discount')->entity
0

Try

$product->field_discount->value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.