Hello,

I'm working on a custom module for calculate VAT on prices provided by Customizable product.
So, i use hook_commerce_tax_type_calculate_rates but if when i want work around $line_item or $tax_type variables, thats seems ajax request (changing country or using a coupon) are broken (Error 200).

Some body coul'd help me to use this hook properly ?

This a very simplified code, but it's enought for ajax breaking.

function tva_cousin_commerce_tax_type_calculate_rates($tax_type, $line_item) {
    drupal_set_message($line_item->line_item_label, 'status', FALSE);
}

Thanks a lot !

Comments

rszrama’s picture

Category: Bug report » Support request
Priority: Major » Normal
Status: Active » Closed (cannot reproduce)

There's no way to tell, to be honest - there isn't enough info here to understand your intent or expected output (or why AJAX comes into it at all). I'd start by looking in your site's watchdog and PHP error logs for clues - could be a simple case of missing data.

benj91’s picture

Thanks for your answer rszrama and you get right, i apologize for my poor explanations.
But i just found a solution.
My module works width a simple condition :

function tva_cousin_commerce_tax_type_calculate_rates($tax_type, $line_item) {

   if(arg(0) == 'checkout'){

       // my code...

   }

}