Is it possible to set special price automatically based on a attribute?

I have an attribute called offerprice in which I enter the percentage of discount.

So if the product price is $100 and I enter 10 in the offerprice field, the special price would automatically be calculated to $90


You can create cart price rule based on Attribute. You have create and assign attribute to product.

Attribute Type Yes/No. Based on that attribute value you can create cart price rule and set condition.

  • Thanks, I tried that, but I need to show the discounted special price along with the regular price in the catalog listing and detail pages. That is why I'm going this way
    – user90560
    Jul 22 '20 at 11:18

In this case, You can do some customisation based on that attribute. You have to set Special price also and need to override/customise getFinalPrice() function.

In that function you can check that attribute's value is yes then workflow as it is. If that attribute's value us no then getFinalPrice() == getActualPrice() and. return finalPrice.

  • Can you point me in the direction of some tutorial or the file path? I'm new to magento development
    – user90560
    Jul 22 '20 at 11:49
  • I don't have any document for this. But you can customise as I suggested.
    – arpit2011
    Jul 22 '20 at 11:51

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.