Created
October 4, 2017 05:50
-
-
Save trueqap/f1529084bea290f3b256271af016b06a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Ingyenes szállítási küszöb - WooCommerce | |
* Plugin URI: https://github.com/trueqap/ingyenes-szallitasi-kuszob-woocommerce | |
* Description: A bővítmény segítségével kiírhatjuk a kosár oldalra, hogy mennyit kell még vásárolni az ingyenes szállításig. | |
* Version: 1.0 | |
* Author: Trueqap | |
* Author URI: https://github.com/trueqap/ | |
* License: GPL2 | |
*/ | |
add_action( 'woocommerce_checkout_before_order_review', 'mennyi_van_hatra', 15); | |
function mennyi_van_hatra() { | |
global $woocommerce; | |
$ingyen_szallitasi_limit = 20000; // Legyen kerek egész szám pénznem jelzés nélkül! Például: 18340 | |
$kosar_total = $woocommerce->cart->cart_contents_total+$woocommerce->cart->tax_total; | |
$jelenleg = number_format($kosar_total, 0, '.', '.'); | |
$mennyit_vasaroljak = $ingyen_szallitasi_limit - $kosar_total; | |
$mennyit_vasaroljak = number_format($mennyit_vasaroljak, 0, '.', '.'); | |
if($kosar_total<$ingyen_szallitasi_limit){ | |
echo '<div style="width:100%; font-size:120%; padding:10px; border: 2px solid #ee3b33">Jelenleg <strong>'.$jelenleg.' Ft</strong> összegű termék van a kosaradban. Vásárolj további <strong>'.$mennyit_vasaroljak.' Ft-ért </strong> és ingyen kiszállítjuk a rendelésedet!</div>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment