Add discount programmatically in Opencart

To add the discount in opencart programmatically follow the following steps:

1. Open <projectFolder>/catalog/model/total/coupon.php
2. Add the code in the getTotal() function

if($total>=0 && $total<=500){
}else if($total>500 && $total<=1000){
}else if($total>1000 && $total<=10000){
$total_data[] = array(
'code'       => 'discount',
'title'      => sprintf("My Special Discount"),
'value'      => -$discount_total,
'sort_order' => 4

3. Now add the products in the cart
4. Goto Cart page check your order info (See the sample screenshot)

Popular posts from this blog

ATG Issue - ConcurrentUpdateException - on BCC Deployment

[Solved] Hive installation error: Relative path in absolute URI

What are EAR, JAR and WAR files in J2EE?