I need to mod a plugin for my needs. Plugin code is as follow:
1. update_post_meta($post_id, '_regular_price', (isset($product['price']) && !empty($product['price'])) ? $product['price'] : '');
2. update_post_meta($post_id, '_sale_price', (isset($product['sale-price']) && !empty($product['sale-price']) && ($product['sale-price']<$product['price']) ) ? $product['sale-price'] : '');
3. update_post_meta($post_id, '_price', (isset($product['price'])) ? $product['price'] : '');
First two rows input the regular price and discount (sale) price values into the database. The third row is the output on the product page, which I need to change so:
- If discounted price
_sale_price / [sale-price]
is present it should be shown as default_price / [price]
on row 3. - If discount price
_sale_price / [sale-price]
is not present the normal price from row 1 should be shown as [price] on row 3
I've tried if (isset($product['sale-price'])){? $product['sale-price'] : '';}else{? $product['price'] : '';}
but this throws 500 error.
Any help appreciated.