Closed Peter22345 closed 3 years ago
skuste v subore zasilkovna.php prepisat tieto funkcie (od riadku 131 nizsie):
add_filter( 'woocommerce_pay4pay_cod_amount', 'wc_zasilkovna_cod_amount' );
function wc_zasilkovna_cod_amount( $amount ) {
if ( sizeof( array_intersect( wc_get_chosen_shipping_method_ids(), array( 'zasilkovna') ) ) > 0 ) {
$packages = WC()->shipping->get_packages();
if(!is_array($packages)) return $amount;
$package = reset($packages);
$shipping_methods = WC()->shipping->load_shipping_methods( $package );
if(!is_array($shipping_methods)) return $amount;
$chosen_method_id = wc_get_chosen_shipping_method_instance_ids()[0];
if(!is_array($chosen_method_id)) return $amount;
$cod_rate = $shipping_methods[ $chosen_method_id ]->get_instance_option( 'cod_rate' );
if ( !empty( $cod_rate ) ) {
$amount = $cod_rate;
}
}
return $amount;
}
add_filter( 'woocommerce_available_payment_gateways', 'wc_zasilkovna_available_payment_gateways' );
function wc_zasilkovna_available_payment_gateways( $gateways ) {
if ( sizeof( array_intersect( wc_get_chosen_shipping_method_ids(), array( 'zasilkovna') ) ) > 0 ) {
$packages = WC()->shipping->get_packages();
if(!is_array($packages)) return $gateways;
$package = reset($packages);
$shipping_methods = WC()->shipping->load_shipping_methods( $package );
if(!is_array($shipping_methods)) return $gateways;
$chosen_method_id = wc_get_chosen_shipping_method_instance_ids()[0];
if(!is_array($chosen_method_id)) return $gateways;
$cod_rate = $shipping_methods[ $chosen_method_id ]->get_instance_option( 'cod_rate' );
if ($cod_rate <= 0) {
unset($gateways['cod']);
}
}
return $gateways;
}
... urcite by to slo urobit aj lepsie, ale takto sa predide vacsine chyb, co mozu vyskocit a teda UX Builder bude fungovat (overene)
Fixed in #19 .
Dobry den, prestal nam fungovat WP UX Builder po instalacii vasho pluginu Zásilkovna Shipping Method.
Viete sa prosim vas na to pozriet? Dakujem velmi pekne