Support » WooCommerce » Woocommerce Manuelle Bestellung

  • Hallo Zusammen

    Ich habe in den Functions.php einige Funktionen drin, damit die Preise, MWST und der Gesamtbetrag auf 05 Rappen gerundet wird.

    add_filter( 'woocommerce_get_price_including_tax', 'round_mwst_preis' );
    function round_mwst_preis ( $amount ) {
    	//round up
    	$round_preis = ceil ( $amount / 0.05 ) * 0.05;
    	//round down
    	//$round_preis = floor ( $amount / 0.05) * 0.05;
    return $round_preis;
    }
    
    add_filter( 'woocommerce_calculated_total', 'custom_calculated_total' );
    function custom_calculated_total( $total ) {
    $total = ceil ( $total / 0.05 ) * 0.05;
    return $total;
    }
    
    add_filter('woocommerce_calculated_subtotal', 'custom_subcalculated_total');
    function custom_subcalculated_total( $total ) {
    $total = ceil ( $total / 0.05 ) * 0.05;
    return $total;
    }
    
    add_filter( 'woocommerce_coupon_get_discount_amount', 'mmx_round_coupon_amount' );
    function mmx_round_coupon_amount( $discount ){
    
    // round up
    $rounded = ceil( $discount / 0.05 ) * 0.05;
    
    // round down
    // $rounded = floor( $discount / 0.05 ) * 0.05;
    
    return $rounded;
    
    }

    Was muss ich verwenden, um die MWST und Produkt-Preise sowie der Gesamtbetrag zu runden, wenn ich bei der BEstellung manuelle Positionen (im Admin-.Bereich) hinzufügen und neu berechnen lassen will?

    Ich habe es lediglich mit den „Zwischensummen“ geschafft mittels:

    
    add_filter('woocommerce_order_get_subtotal', 'custom_order_subtotal');
    function custom_order_subtotal( $total ) {
    $total = ceil ( $total / 0.05 ) * 0.05;
    return $total;
    }
     

    Die anderen Filter/Hooks finde ich nicht. WEnn ich order_get_tax_totals verwende, erhalte ich dann einen Fehler.

    Kann mir hier jemand ein Tip geben?
    DAnke

  • Das Thema „Woocommerce Manuelle Bestellung“ ist für neue Antworten geschlossen.