I am trying to add a condition for checked the special price is valid or not for list page but did not able to find.


Use getFinalPrice() with product object. eg. $_product->getFinalPrice(); This will gives price if special price if it applicable otherwise gives regular price.

  • it give but after special price expire also applicable, I want not selected if sepcial price gonna be expired Sep 25 '18 at 12:06
  • you can find start date and end date in print_r($_product); then compare date as if(strtotime($date1))<strtotime($date2)))
    – user55548
    Sep 25 '18 at 13:04

After Few Time I found at last:- $specialPriceFromDate = $_product->getData('special_from_date'); $specialPriceToDate = $_product->getData('special_to_date'); $today = time();

                if ($specialprice && ($_product->getData('price') > $_product->getData('final_price'))):
                    if($today >= strtotime( $specialPriceFromDate) && $today <= strtotime($specialPriceToDate) || 
                        $today >= strtotime( $specialPriceFromDate) && is_null($specialPriceToDate)):

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.