• Resolved Avinash Patel

    (@avinashdigitl)


    Hello this is not working correct in our site, we have used our own product customizer as per above comment and setting custom product price when adding product into cart. But it does not working correctly, can you please test it and give feedback on this ASAP?

    Product link: https://wordpress-281395-2623766.cloudwaysapps.com/wedding-stationery/change-of-plan-cards/alexander-change-of-plan/#!

    Working correct for GBP:
    product multistep: https://prnt.sc/IQ4k7MVaaFpY
    cart(correct): https://prnt.sc/ni81YHhxcCHn

    Working not correct for CAD:
    product multistep: https://prnt.sc/XKVHUB1p3IMN
    cart (In-correct): https://prnt.sc/oBKAsWi7GGDZ

    We have used below code to set custom price of product:

    // Update the price when the user adds a product to the cart 
    function add_cart_item_data( $cart_item_data, $product_id, $variation_id ) {
    
    	$is_smaple = $_POST['sample'];
    
    	if (isset($is_smaple) && $is_smaple) {
    		// do nothing
    	} else {
    	    $product = wc_get_product( $product_id );
    	    $price = $product->get_price();
    	    
    	    $product_new_price = $cart_item_data['product_new_price'];
    	    
    	    if( ! empty( $product_new_price ) ) {   
    	        $cart_item_data['new_price'] = wmc_revert_price($product_new_price);
    	    }
    	}
    
    	return $cart_item_data;
    }
    add_filter( 'woocommerce_add_cart_item_data', 'add_cart_item_data', 10, 3 );
    
    
    // Recalculate the total price of the cart
    function before_calculate_totals( $cart ) {
    	global $woocommerce;
    
    	if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
    		return;
    	}
    
    	foreach( $cart->get_cart() as $cart_item_key =>$value ) {
    		if( isset( $value['new_price'] ) ) {
    			$price = $value['new_price'];
    			$value['data']->set_price( ( $price ) );
    		}
    	}
    }
    add_action( 'woocommerce_before_calculate_totals', 'before_calculate_totals', 10, 1 );

    Hello is there any update on this please?
    (Note: We are removing VAT when currency is other expect GBP)

    // Remove VAT Calculation from specific countries //
    function extempt_vat_for_non_eu_firms()
    {
    	if (class_exists('WOOMULTI_CURRENCY_Data')) {
    		$currency_data_obj = new WOOMULTI_CURRENCY_Data();
    		$current_currency = $currency_data_obj->get_current_currency();
    
    		if ($current_currency == 'GBP') {
    			WC()->customer->set_is_vat_exempt(false);
    		} else {
    			WC()->customer->set_is_vat_exempt(true);
    		}
    	} else {
    		WC()->customer->set_is_vat_exempt(true);
    	}
    }
    add_action('template_redirect', 'extempt_vat_for_non_eu_firms');
    

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Wrong currency in other language’ is closed to new replies.