woocommerce_before_calculate_totals not working properly
-
The price is added twice in the total. if you add a product in cart and selected the price, the total price is correct in the checkout, but if the customer create his account in same process than his checkout then the price is added twice after proced payment. This is my code
function calculate_gift_wrap_fee( $cart_object ) {
/* Gift wrap price */
$additionalPrice = 100;
foreach ( $cart_object->cart_contents as $key => $value ) {
if( isset( $value[“gift_wrap_fee”] ) ) {
$orgPrice = floatval( $value[‘data’]->price );
$value[‘data’]->price = ( $orgPrice + $additionalPrice );
}
}
}
add_action( ‘woocommerce_before_calculate_totals’, ‘calculate_gift_wrap_fee’, 99 );
- The topic ‘woocommerce_before_calculate_totals not working properly’ is closed to new replies.