Hallo,
zun?chst wünsche ich Ihnen ein frohes neues Jahr 2018!
Das o.g. Problem haben wir durch Eigenentwicklung gel?st. Hierfür anhand der Kalkulation des Gesamtgewichtes im Warenkorb ‘$woocommerce->cart->cart_contents_weight’ die Regeln erstellt.
Allerdings haben wir ein anderes Problem mit den Ma?en über 120x60x30 cm festgestellt. K?nnen Sie sich bitte das neue Topic anschauen?
Nachfolgend ist unser L?sungsansatz (/woocommerce/cart/cart-shipping.php):
if ( ! defined( ‘ABSPATH’ ) ) {
exit;
}
?>
<tr class=”shipping”>
<th><?php echo wp_kses_post( $package_name ); ?></th>
<td data-title=”<?php echo esc_attr( $package_name ); ?>”>
<?php if ( 1 < count( $available_methods ) ) : ?>
<ul id=”shipping_method”>
<?php
// **************** Cusomizing LEORIA
?>
<?php foreach ( $available_methods as $method ) : ?>
<?php
global $woocommerce;
$max_weight = 31.5;
$versanddienstleister = esc_attr( $method->id );
//echo $versanddienstleister;
$spedition = ‘awd_shipping’ ;
//awd_shipping aus dem Plugin ‘oik Weight/Country Shipping’
/** Lieferung per Spedition */
if ( $woocommerce->cart->cart_contents_weight > $max_weight && $versanddienstleister == $spedition) { ?>
-
<?php
//echo ‘ ‘ . ‘Spedition-Lieferung!’ . ‘ ‘;
//echo $versanddienstleister;
printf( ‘<input type=”radio” name=”shipping_method[%1$d]” data-index=”%1$d” id=”shipping_method_%1$d_%2$s” value=”%3$s” class=”shipping_method” %6$s />
<label for=”shipping_method_%1$d_%2$s”>%5$s</label>’,
$index, sanitize_title( $method->id ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ), wc_cart_totals_shipping_method_label( $method ), ‘checked=”checked”‘ );
}
/** Lieferung per andere Dienstleister */
if ( $woocommerce->cart->cart_contents_weight < $max_weight && $versanddienstleister != $spedition) { ?>
-
<?php
//echo ‘ ‘ . ‘andere Dienstleister!’ . ‘ ‘;
//echo $versanddienstleister;
printf( ‘<input type=”radio” name=”shipping_method[%1$d]” data-index=”%1$d” id=”shipping_method_%1$d_%2$s” value=”%3$s” class=”shipping_method” %4$s />
<label for=”shipping_method_%1$d_%2$s”>%5$s</label>’,
$index, sanitize_title( $method->id ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ), wc_cart_totals_shipping_method_label( $method ) );
}
// **************** Gustomizing LEORIA Ende
do_action( ‘woocommerce_after_shipping_rate’, $method, $index );
?>
<?php endforeach; ?>
……..