[Skip to main content](#vessel-content)

#   How to display "Only X more to get free shipping"?

##

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile")
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

10 years 4 months ago [\#244573](#244573) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#244573 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Joomla 3.5.1
Hikashop 2.6.3

So right now I am using this code in the checkout / cart.php file
Code:

if($this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping &lt; 900){ $diffQty = 900 - $this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping; $app = JFactory::getApplication(); $app-&gt;enqueueMessage(JText::sprintf('MISSING_QTY_FOR_FREE_SHIPPING',$diffQty)); }

But now I have just started adding tax to my products, and now the above code is displaying the message with prices based on the price without tax.

I need the message to be displayed based on the price with tax( price_value_with_tax;). So somewhere in the code above I need to place this: "price_value_with_tax;"

Any advice on how I can get it right ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

10 years 4 months ago [\#244581](#244581) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#244581 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Hi,

Instead of price_value_without_shipping, you want to use price_value_without_shipping_with_tax

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile")
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

10 years 3 months ago [\#247571](#247571) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#247571 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

I now have this function on the top of my checkout, and it works very well.
More customers are buying more to get free shipping after I implementet it.

Is it possible to have this function do display in my shopping cart module ?

See attached image to see what I mean:

[ ![cart&#95;screen.png](/forum/attachment/33010) ](/forum/attachment/33010 "cart&#95;screen.png")

Tnx

- [ ![cart&#95;screen.png](/forum/attachment/33010) ](/forum/attachment/33010 "cart&#95;screen.png") [ ](/forum/attachment/33010?download=1 "cart&#95;screen.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

10 years 3 months ago [\#247575](#247575) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#247575 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Hi,

You can use almost the same code.
Instead of $this-&gt;full_total you need to use $this-&gt;total
The rest should be the same.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile")
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

10 years 3 months ago [\#247768](#247768) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#247768 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Tnx

In which php. file to I need to place the code ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

10 years 3 months ago [\#247770](#247770) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#247770 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Hi,

No in a PHP file, in a view.
**Do not edit HikaShop PHP files !**

They are two views for the carts "checkout / cart" and "product / cart".

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile")
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

10 years 3 months ago [\#247944](#247944) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#247944 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

No, I want to display this message inside the hikashop cart module.

Any advice?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

10 years 3 months ago [\#247945](#247945) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#247945 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

> They are two views for the carts "checkout / cart" and "**product / cart**"

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile")
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

10 years 3 months ago -  10 years 3 months ago [\#248121](#248121) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#248121 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Joomla 3.6.2
Hikashop 2.6.3

This is the code I am using in the checkout / cart.php file:
Code:

if($this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax &lt; 900){ $diffQty = 900 - $this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping; $app = JFactory::getApplication(); $app-&gt;enqueueMessage(JText::sprintf('MISSING_QTY_FOR_FREE_SHIPPING',$diffQty)); }

I've discovered something strange with the code.

I have free freight when a customers buys for more than NOK 900,-

When the price of the products in the checkout is below NOK 1 125 the message in the checkout says.

"Message
If you shop for NOK -224 more you get free shipping!"

I have noticed that there is a minus in front of the value.

NOTE: The NOK minus price varies. I.e if the total price is NOK 967, the message says: If you shop for NOK -67,- more you get free shipping!"

If the price of the products is NOK 1125 av above the message don't display and working just fine.

I know that this has some to do with the tax. Because the tax rate in Norway is 25%, ....and NOK 900 x 1,25 = 1125

Any advice on how to fix this ?

Last edit: 10 years 3 months ago by [river](/forum/user/9591-river "View river's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[GW](/forum/user/33851-gw "View GW's Profile")**
- [![GW's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/33851-gw "View GW's Profile")
- [ Offline](/forum/user/33851-gw)

Less More

- Posts: 200
- Thank you received: 75
-
-

10 years 3 months ago [\#248123](#248123) by [GW](/forum/user/33851-gw "View GW's Profile")  Replied by *[GW](/forum/user/33851-gw "View GW's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#248123 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Hi,

I was just browsing through this post, you may have the prices with and without tax mixed up.

In the first line you check the price_value_without_shipping_with_tax against 900, but then in the second line you still use the price_value_without_shipping (so not with tax) to subtract from 900.

Make sure you use the same price value everywhere, it should work correctly.

Regards,

The following user(s) said Thank You: [Jerome](/forum/user/80-jerome "View Jerome's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile")
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

10 years 3 months ago -  10 years 3 months ago [\#248142](#248142) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#248142 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Hi !
Tnx man ..... I didn't notice. so now I used the code:
Code:

&lt;?php if($this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax &lt; 900){ $diffQty = 900 - $this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax; $app = JFactory::getApplication(); $app-&gt;enqueueMessage(JText::sprintf('MISSING_QTY_FOR_FREE_SHIPPING',$diffQty)); }

And now it works ! ![=)](/smile.gif "=)")

Last edit: 10 years 3 months ago by [river](/forum/user/9591-river "View river's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile")
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

10 years 2 months ago -  10 years 2 months ago [\#251173](#251173) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#251173 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Joomla 3.6.2
Hikashop 2.6.4

Until now I only have displayed this message in the checkout.

So now I want it also to display above each product.
So I placed this code in the view/product / show_default file:

Code:

&lt;?php if($this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax &lt; 900){ $diffQty = 900 - $this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax; $app = JFactory::getApplication(); $app-&gt;enqueueMessage(JText::sprintf('MISSING_QTY_FOR_FREE_SHIPPING',$diffQty)); }

It display fine, but that's all.

Now the message is just static and says (even if a customer ads products to the basket):

"Message
If you buy for NOK 900, - you get free shipping!"

I need the message to display (before the customers ads products to the basket)

"If you buy for NOK 900, - or more you get free shipping!"

And after the customer ads product to the basket (i.e value of products is NOK 399,-) I need it to say:

"If you buy for NOK 501,- more you get free shipping!"

And after the customers ads products to the value of NOK 900 or above the message disappears.

Any advice on how to adjust the code to work like this ?

Last edit: 10 years 2 months ago by [river](/forum/user/9591-river "View river's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

10 years 2 months ago [\#251179](#251179) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#251179 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Hi,

$this-&gt;full_total is not defined on that view file.
You need to add that code before: Code:

$class = hikashop_get('class.cart'); $cart = $class-&gt;loadFullCart(); $this-&gt;full_total =&amp; $cart-&gt;full_total;

and then your code will work.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile")
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

10 years 1 month ago -  10 years 1 month ago [\#251214](#251214) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#251214 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Tnx for reply

So i added this code
Code:

&lt;?php $class = hikashop_get('class.cart'); $cart = $class-&gt;loadFullCart(); $this-&gt;full_total =&amp; $cart-&gt;full_total; if($this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax &lt; 900){ $diffQty = 900 - $this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax; $app = JFactory::getApplication(); $app-&gt;enqueueMessage(JText::sprintf('MISSING_QTY_FOR_FREE_SHIPPING',$diffQty)); }

It works fine.

But there's a small problem.

It only works after I add a product to the basket and proceed to checkout, and after that go back to a product.

Then it displays correct.

Any advice on how to make it display correctly after I just adding a product to the basket ? (without going to the checkout, and back to a product page)

Hope my explenation makes sense ![=)](/smile.gif "=)")

Last edit: 10 years 1 month ago by [river](/forum/user/9591-river "View river's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[GW](/forum/user/33851-gw "View GW's Profile")**
- [![GW's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/33851-gw "View GW's Profile")
- [ Offline](/forum/user/33851-gw)

Less More

- Posts: 200
- Thank you received: 75
-
-

10 years 1 month ago [\#251221](#251221) by [GW](/forum/user/33851-gw "View GW's Profile")  Replied by *[GW](/forum/user/33851-gw "View GW's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#251221 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Hi,

if I understand correctly you mean the cart is automatically updated through Ajax when someone adds a product, while the message is not updated since it is static content only generated on pageload.

One possible solution would be to simply disable Ajax in your Hikashop configuration. That way the page will always refresh when the "Add to cart" button is clicked and the message will also be updated.

It would probably be possible to do what you want without page refresh by creating a plugin using something like the trigger "onAfterCartUpdate", though it would also be possible by just adding some Javascript that gets executed when the "Add to cart" button is pressed, which is what we use. It's perhaps not the most elegant solution, but this way would also allow you update the message to always display correctly.

Let me know if you're interested in the Javascript solution.

Kind regards,

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile")
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

10 years 1 month ago [\#251278](#251278) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#251278 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

The Javascript solutions sound like a good idea. What kind of code should I use ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[GW](/forum/user/33851-gw "View GW's Profile")**
- [![GW's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/33851-gw "View GW's Profile")
- [ Offline](/forum/user/33851-gw)

Less More

- Posts: 200
- Thank you received: 75
-
-

10 years 1 month ago [\#251304](#251304) by [GW](/forum/user/33851-gw "View GW's Profile")  Replied by *[GW](/forum/user/33851-gw "View GW's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#251304 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Hi,

below is the Javascript code we used, I'll give some explanation further down. You can add the code for example all the way at the end of your show_default view: Code:

&lt;script&gt; jQuery(function(){ jQuery('.hikashop_cart_input_button').click(function(){ setTimeout(function(){ var qtyForFreeShipping = jQuery('td.hikashop_cart_module_product_total_value span.hikashop_product_price').text().replace(/,/g,"."); var diffQty = 900 - parseFloat(qtyForFreeShipping.substr(qtyForFreeShipping.indexOf(" "))); if(diffQty &lt; 0){ jQuery('#system-message &gt; div').hide(); } else{ jQuery('#qtyForFreeShipping').text(diffQty); } },800); }); }); &lt;/script&gt;

It looks more complicated than it is.
First we register the click event when someone clicks on the "Add to cart button": Code:

jQuery('.hikashop_cart_input_button').click(function(){

Because the Ajax call always takes a little while to complete, we had to add a timeout to wait for about 800ms to be sure we always get the correct updated total price: Code:

setTimeout(function(){ ... },800);

Then we need to grab the total price from the page. Since we have a Hikashop Cart Module on all our pages we can easily get the current total price from there and calculate the diffQty: Code:

var qtyForFreeShipping = jQuery('td.hikashop_cart_module_product_total_value span.hikashop_product_price').text().replace(/,/g,"."); var diffQty = 900 - parseFloat(qtyForFreeShipping.substr(qtyForFreeShipping.indexOf(" ")));

If your prices have decimal values, the comma needs to be replaced by a dot and we need to get rid of the currency symbol in front with a substr before we can use parseFloat to change the string to a number.

Then we have a simple if-else to hide the system message if the total cart value is above 900, or otherwise modify the value in the message. To grab the price in your message with jQuery, the easiest way is to put a span with a unique class or id around the price value in your MISSING_QTY_FOR_FREE_SHIPPING constant, so change it to something like: Code:

MISSING_QTY_FOR_FREE_SHIPPING = If you buy for NOK &lt;span id="qtyForFreeShipping"&gt;%s&lt;/span&gt; or more you get free shipping!

Then we can simply update the value with jQuery by grabbing the id "qtyForFreeShipping": Code:

jQuery('#qtyForFreeShipping').text(diffQty);

And that's it, for us this works fine.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile")
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

10 years 1 month ago [\#251503](#251503) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#251503 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Tnx man

I will try it out.

I'll give you a feedback when I've tested it.

Regards ![=)](/smile.gif "=)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile")
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

10 years 1 month ago [\#251613](#251613) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#251613 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

> river wrote: Tnx for reply
>
> So i added this code
>
> Code:
>
> &lt;?php $class = hikashop_get('class.cart'); $cart = $class-&gt;loadFullCart(); $this-&gt;full_total =&amp; $cart-&gt;full_total; if($this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax &lt; 900){ $diffQty = 900 - $this-&gt;full_total-&gt;prices[0]-&gt;price_value_without_shipping_with_tax; $app = JFactory::getApplication(); $app-&gt;enqueueMessage(JText::sprintf('MISSING_QTY_FOR_FREE_SHIPPING',$diffQty)); }
>
>
>
> It works fine.
>
> But there's a small problem.
>
> It only works after I add a product to the basket and proceed to checkout, and after that go back to a product.
>
> Then it displays correct.
>
> Any advice on how to make it display correctly after I just adding a product to the basket ? (without going to the checkout, and back to a product page)
>
> Hope my explenation makes sense ![=)](/smile.gif "=)")

Unfortunately the Javascript soulution dosent work ![:(](/media/kunena/emoticons/22.png ":(")
.
Any advice from you Hikashop guys on how to solve this without Javascript ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

10 years 1 month ago [\#251642](#251642) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to display "Only X more to get free shipping"?](/forum/25-install-update/876200-how-to-display-only-x-more-to-get-free-shipping?start=20#251642 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.4.27 -- Browser(s) name and version -- : Firefox 36.0.4 -- Error-message(debug-mod must be tuned on) -- : N/A  Hi,  Is there a built-in function in HikaShop to display how much more a customer needs to spend in order to receive free shipping? All of our products are charged shipping according to weight. However, once they spend $75.00 or more, they receive free shipping.  Is there a way to add a status / progress bar that will alert customers they only have to spend X more to qualify for free shipping?")*

Hi,

The javascript solution looks good to me.
If it doesn't work, it might be because of the way HikaShop is configured in your way which isn't compatible with that.
Or maybe you didn't add it properly to the page.
But I still see a javascript solution as the way to go, even though it might require some adaptation for your case.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NjIwMC1ob3ctdG8tZGlzcGxheS1vbmx5LXgtbW9yZS10by1nZXQtZnJlZS1zaGlwcGluZz9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.143 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
