Total discounts amount

  • Posts: 48
  • Thank you received: 3
3 weeks 5 days ago #364120

-- HikaShop version -- : 5.1.1
-- Joomla version -- : 5.2.0
-- PHP version -- : 8.2

Hi
suppose that I have 3 products in my cart, which I have $2 discount on each

how can I display the total discount (which will be $6 in this example) in my cart summery ?

Please Log in or Create an account to join the conversation.

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
3 weeks 4 days ago #364122

Hi,

There is no option for such a display. You would need to edit the checkout / show_block_cart view file via the menu Display>Views to add custom PHP code to calculate that total discount amount and then display it.

Please Log in or Create an account to join the conversation.

  • Posts: 48
  • Thank you received: 3
3 weeks 4 days ago #364128

I used print_r and fount somewhere that total_price_without_discount
if i could echo this number somewhere in that file, i can get total discount amount by subtracting total price wiout discout and total price

but i cant get that total without dicount :(

Please Log in or Create an account to join the conversation.

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
3 weeks 4 days ago #364130

Hi,

The "total_price_without_discount" is the subtotal without coupons added, not discounts. So, it's not what you want.
You need to loop through the $cart->products array and in each product object, if there is a "discount" attribute object then the discount_flat_amount can be summed.
This will give you the total discount amount.

Please Log in or Create an account to join the conversation.

Time to create page: 0.048 seconds
Powered by Kunena Forum