This file contains hidden or 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 | |
// Paste everything below this line to your theme's functions.php file. | |
// Hide shipping option labels. | |
// Example: | |
// — Regular Shipping: $20 => $20 | |
// — Express Shipping: $30 => $30 | |
// — Free Shipping => Free | |
add_filter('woocommerce_cart_shipping_method_full_label', function($label) { | |
@list(, $price) = explode(':', $label); |
This file contains hidden or 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 | |
// Paste everything below this line to your theme's functions.php file. | |
add_filter('woocommerce_package_rates', function($rates, $package) { | |
$destination = $package['destination']; | |
// Put postcode, address 1 and address 2 into an array | |
$check_address = array( | |
$destination['address'], |
This file contains hidden or 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 | |
// Paste everything below this line to your theme's functions.php file. | |
add_filter('woocommerce_package_rates', function($rates) { | |
/** @var WC_Shipping_Rate[] $rates */ | |
/** @var WC_Shipping_Rate[] $uniqueRates */ | |
$uniqueRates = array(); | |
foreach ($rates as $key => $rate) { |
This file contains hidden or 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 | |
// Paste everything below this line to your theme's functions.php file. | |
add_filter('woocommerce_package_rates', 'round_shipping_price_for_swiss_franc'); | |
function round_shipping_price_for_swiss_franc($rates) | |
{ | |
if (is_array($rates)) { | |
foreach ($rates as $rate) { | |
$rate->cost = ceil($rate->cost / 0.05) * 0.05; |
NewerOlder