Checkout Shipping_Rate Hook Problem

I am trying to hide "(inc tax)" from after the price of the shipping method in the checkout.

I have gone into templates / views / checkout / components / shipping_rates.tpl

I have modified the code directly in the template for the hook checkout:shipping_rate to:

{$delivery_time = ""}
                        {if $shipping.delivery_time || $shipping.service_delivery_time}
                            {$delivery_time = "(`$shipping.service_delivery_time|default:$shipping.delivery_time`)"}
                        {/if}
                    {if $shipping.rate}
                        {capture assign="rate"}{include file="common/price.tpl" value=$shipping.rate}{/capture}
                        {*if $shipping.inc_tax}
                            {$rate = "`$rate` ("}
                            {if $shipping.taxed_price && $shipping.taxed_price != $shipping.rate}
                                {capture assign="tax"}{include file="common/price.tpl" value=$shipping.taxed_price class="ty-nowrap"}{/capture}
                                {$rate = "`$rate``$tax` "}
                            {/if}
                            {$inc_tax_lang = __('inc_tax')}
                            {$rate = "`$rate``$inc_tax_lang`)"}
                        {/if*}
                    {elseif fn_is_lang_var_exists("free")}
                        {$rate = __("free")}
                    {else}
                        {$rate = ""}
                    {/if}

Commenting out the tax bit of the code has worked fine when i make the changes directly to the template file.

If however i add this same code to shipping_rate.override.tpl and upload it to design/themes/vivashop/templates/addons/my_changes/hooks/checkout the code doesn't work.

I can't for the life of me see what i am missing.

What am i doing wrong?

Is there maybe another way of hiding this text? If i just remove the language text 'inc_tax' i am still left with the ()...

Thanks

Hello

Did you cleare cache ?

What is the name of the file in which you are doing overwrite?

Best regards

Robert

At first delete the var/cache directory manually

I have deleted the cache folder and cleared the cache.

The hook checkout:shipping_rate is in:

templates / views / checkout / components / shipping_rates.tpl

The file with my changed code is:

design/themes/vivashop/templates/addons/my_changes/hooks/checkout/shipping_rate.override.tpl

I have added some random text into the override file to see what is being pulled so i can see that the file is being loaded but it in't displaying how i would expect.

The random text is being shown outside the shipping method box.

The test code i am using in the override is:

aaa{$delivery_time = ""}bbb
                        {if $shipping.delivery_time || $shipping.service_delivery_time}
                            {$delivery_time = "(`$shipping.service_delivery_time|default:$shipping.delivery_time`)"}
                        {/if}
ccc
                        {if $shipping.rate}ddd
                            {capture assign="rate"}{include file="common/price.tpl" value=$shipping.rate}{/capture}
                           eee {if $shipping.inc_tax}
                                {$rate = "`$rate` (11"}
                                {if $shipping.taxed_price && $shipping.taxed_price != $shipping.rate}
                                    {capture assign="tax"}{include file="common/price.tpl" value=$shipping.taxed_price class="ty-nowrap"}{/capture}
                                    {$rate = "33`$rate``$tax` 44"}
                                {/if}
                                {$inc_tax_lang = __('inc_tax')}
                                {$rate = "`$rate``$inc_tax_lang`22)"}
                            222{/if}eee
                        {elseif fn_is_lang_var_exists("free")}
                            {$rate = __("free")}fff
                        {else}
                            {$rate = ""}ggg
                        {/if}hhh

and displays as in this image:

At least i can see it is seeing the file ok but i'm sure some of these bits should be in the shipping method boxes.

Hello

I think you should try to change here.

{$shipping.shipping}{if $rate} — {$rate nofilter}{/if}

Best regards

Robert

Thanks for this line.

I've just had a quick look at this. Unfortunately {$rate nofilter} returns both the price and the (inc tax) part. I am trying to stop the display of the (inc tax).

What does the nofilter part of the code mean? Can i change this to somthing else to return only the shipping method price?

Hello

Please change this

{$inc_tax_lang = __('inc_tax')}

on

{$inc_tax_lang = ""}

"nofilter" - this means that the variable is displayed without filtering the data (without cutting html markers)

Best regards

Robert

If i make this change directly to the template file i get the shipping method price followed by () e.g. £3.00 ().

I can see where these brackets are coming from and where to remove them. {$rate = "`$rate` ("} and {$rate = "`$rate``$inc_tax_lang`)"}

However when i make the same change to the override file in my_changes nothing happens. This is what is puzzling me...

Hello
Comment this parts from code
{*{$rate = "`$rate`"}*}
{if $shipping.taxed_price && $shipping.taxed_price != $shipping.rate}
{capture assign="tax"}{include file="common/price.tpl" value=$shipping.taxed_price class="ty-nowrap"}{/capture}
{*{$rate = "`$rate``$tax` "}*}
{/if}
{$inc_tax_lang = __('inc_tax')}
{*{$rate = "`$rate``$inc_tax_lang`)"}*}
And send info if it worked
Best regards
Robert

Looks like this hook is overrided by one more addon. As a result you see your changes, but the final result is received from 3rd party module

Thanks for the changes Robert, these make everything display how i'd like. I just can't get it to work using the my_changes addon.

I have now tried manually disabling all addons except the my_changes addon, removed the other .tpl files in my_changes and reverted to the default template.

Unfortunately i am still seeing the (inc tax) displayed.

Hello

If your prints that you do in the main file show up, it means that this hook is not overwritten (and this suggests your screen from the previous post)
If it's not overwritten, it means something is wrong with your addon. Maybe the space got stuck somewhere?
Maybe try transferring my_changes to responsive from vivashop?
Best regards
Robert

The addon is working ok for other modified templates that i have put into my_changes. It is just this one.

I'll keep playing around and post back if i discover what is causing this. I'll just make the changes to the main template files for the meantime.

Thanks for your help

Hello

You are welcome :)

Best regards

Robert