Jump to content

Hard Code Free Shipping voucher


wjbeckett

Recommended Posts

Hi all,

I'm looking for a way to have a voucher code hard coded into the shop somehow.

 

The reason I wanted to do this is so I could have a voucher that will apply free shipping but will not be included in the "total_discounts" function so that if a user adds the free shipping voucher to the cart the "Total Shipping" will change to Free Shipping! but will also allow you to add another voucher.

 

I currently have this half working by changing some stuff around in the shopping-cart.tpl as below.

<tr class="cart_total_voucher" {if $total_discounts == 0 OR $total_discounts == 12}style="display:none"{/if}>
					<td colspan="{$col_span_subtotal}" class="text-right">
						{if $display_tax_label}
							{if $use_taxes && $priceDisplay == 0}
								{l s='Total vouchers:'}
							{else}
								{l s='Total vouchers'}
							{/if}
						{else}
							{l s='Total vouchers'}
						{/if}
					</td>
					<td colspan="2" class="price-discount price" id="total_discount">
						{if $use_taxes && $priceDisplay == 0}
							{assign var='total_discounts_negative' value=$total_discounts * -1}
						{else}
							{assign var='total_discounts_negative' value=$total_discounts_tax_exc * -1}
						{/if}
						{displayPrice price=$total_discounts_negative}
					</td>
				</tr>
				{if $total_discounts == 12 OR $total_shipping_tax_exc <= 0 && !isset($virtualCart)}
					<tr class="cart_total_delivery" style="{if !isset($carrier->id) || is_null($carrier->id)}display:none;{/if}">
						<td colspan="{$col_span_subtotal}" class="text-right">{l s='Shipping'}</td>
						<td colspan="2" class="price" id="total_shipping">{l s='Free Shipping!'}</td>
					</tr>
				{else}
				{*{if $total_shipping_tax_exc <= 0 && !isset($virtualCart)}
					<tr class="cart_total_delivery" style="{if !isset($carrier->id) || is_null($carrier->id)}display:none;{/if}">
						<td colspan="{$col_span_subtotal}" class="text-right">{l s='Shipping'}</td>
						<td colspan="2" class="price" id="total_shipping">{l s='Free Shipping!'}</td>
					</tr>
				{else}*}
					{if $use_taxes && $total_shipping_tax_exc != $total_shipping}
						{if $priceDisplay}
							<tr class="cart_total_delivery" {if $total_shipping_tax_exc <= 0} style="display:none;"{/if}>
								<td colspan="{$col_span_subtotal}" class="text-right">{if $display_tax_label}{l s='Total shipping (tax excl.)'}{else}{l s='Total shipping'}{/if}</td>
								<td colspan="2" class="price" id="total_shipping">{displayPrice price=$total_shipping_tax_exc}</td>
							</tr>
						{else}
							<tr class="cart_total_delivery"{if $total_shipping <= 0} style="display:none;"{/if}>
								<td colspan="{$col_span_subtotal}" class="text-right">{if $display_tax_label}{l s='Total shipping (tax incl.)'}{else}{l s='Total shipping'}{/if}</td>
								<td colspan="2" class="price" id="total_shipping" >{displayPrice price=$total_shipping}</td>
							</tr>
						{/if}
					{else}
						<tr class="cart_total_delivery"{if $total_shipping_tax_exc <= 0} style="display:none;"{/if}>
							<td colspan="{$col_span_subtotal}" class="text-right">{l s='Total shipping'}</td>
							<td colspan="2" class="price" id="total_shipping" >{displayPrice price=$total_shipping_tax_exc}</td>
						</tr>
					{/if}
				{/if}

I've added "OR $total_discounts == 12" to the first line which will hide the "Total Vouchers" line if the free shipping code is entered (Shipping is a flat rate of $12 on my store). 

 

I've also added 

{if $total_discounts == 12 OR $total_shipping_tax_exc <= 0 && !isset($virtualCart)}
					<tr class="cart_total_delivery" style="{if !isset($carrier->id) || is_null($carrier->id)}display:none;{/if}">
						<td colspan="{$col_span_subtotal}" class="text-right">{l s='Shipping'}</td>
						<td colspan="2" class="price" id="total_shipping">{l s='Free Shipping!'}</td>
					</tr>
				{else}

which will, if the voucher equals $12, will change the Shipping total to show "Free Shipping!" instead of the price.

 

So I have it working as I want for the Free shipping side of it, however if the total discounts equals more than $12 (happens if another voucher is added) the shipping price comes back in and the shipping discount voucher is added to the "Total Vouchers" line.

 

Is there a way of separating this? Is there a way of making the free shipping voucher act independently to any other voucher so I can have the words "Free Shipping!" in the shipping cost as well as having another discount applied to the shopping cart?

 

Any help would be greatly appreciated!

 

Thanks,

Will.

Link to comment
Share on other sites

Anyone?

 

I'd like to be able to do something like:

If Voucher = "FreeShipping"
<tr class="cart_total_delivery" style="{if !isset($carrier->id) || is_null($carrier->id)}display:none;{/if}">
<td colspan="{$col_span_subtotal}" class="text-right">{l s='Shipping'}</td>
<td colspan="2" class="price" id="total_shipping">{l s='Free Shipping!'}</td>
</tr>
Else
blah..

Is it possible at all?

Edited by wjbeckett (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...

We are running into a similar issue. We want to offer a voucher that gives 25% off as well as free shipping. 

 

In our example, the product costs $100.00

In theory, we would want the checkout page to show Free Shipping and 25$ off, but instead it shows $9.57 (Normal shipping rate) and a discount of $34.57 (The 25% discount PLUS the cost of shipping, making a net shipping cost of 0).

 

Is there any way to just make it set the shipping cost to $0.00 when it sees a voucher with free shipping is applied so that the total discount line shows up appropriately rather than adding the cost of shipping to the discount?

Edited by banstett (see edit history)
  • Like 1
Link to comment
Share on other sites

We are running into a similar issue. We want to offer a voucher that gives 25% off as well as free shipping. 

 

In our example, the product costs $100.00

In theory, we would want the checkout page to show Free Shipping and 25$ off, but instead it shows $9.57 (Normal shipping rate) and a discount of $34.57 (The 25% discount PLUS the cost of shipping, making a net shipping cost of 0).

 

Is there any way to just make it set the shipping cost to $0.00 when it sees a voucher with free shipping is applied so that the total discount line shows up appropriately rather than adding the cost of shipping to the discount?

 

This is exactly what I am try to achieve. 

Hopefully someone out there can assist or can point us in the right direction to get this working?

 

Thanks everyone.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...