Spend more to get free shipping

  • Posts: 54
  • Thank you received: 0
4 years 6 months ago #318180

-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.18
-- PHP version -- : 7.3

Hello,
I have my site setup and when a customer adds products to the cart and goes through the checkout process I offer various shipping options.

However I would like to provide them with information to allow them to get free shipping by purchasing more products!

As an example, e a customer purchases £8.00 worth of goods, shipping will cost £5. However if they increase their purchase above £10 then shipping would be free.

On the shipping page of the checkout process below where they select from the radio buttons for the shipping options, how can I dynamically display something along the lines of:

Spend £2 more to get free shipping.

Can I get the current variable for the total cart value? How can I access this via PHP, I have tried to echo and var_dump the cart but get lost trying to locate the cart total. If I knew how to access this total cart variable I can then create something along the lines of:

$get_free_shipping = (10 - $cart_total);

echo 'Why not spend '.$get_free_shipping.' more and get free shipping';

How can I get the cart total?

Thanks

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
4 years 6 months ago #318189

Hi,

In the checkout / show_block_*.php files, you can get the cart total like that:

$cart = $this->checkoutHelper->getCart();
$cart_total = $cart->full_total->prices[0]->price_value_with_tax;

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

Time to create page: 0.052 seconds
Powered by Kunena Forum