Logo
BigM @bigm
1 jour
nelson @nelson
1 jour
a répondu au Message de BigM - 1 jour
BigM @bigm
1 jour
a répondu au Message de nelson - 1 jour
Eolia @eolia
1 jour
a répondu au Message de BigM - 1 jour
BigM @bigm
20 h.
a répondu au Message de Eolia - 20 h.
BigM @bigm
19 h.
a répondu au Message de BigM - 19 h.
Eolia @eolia
a répondu au Message de BigM - 3 h.
Vous pouvez aussi faire une override de Product.php

CODE
class Product extends ProductCore
{
const US_COUNTRY_ID = 21;
const RATE = 0.10;

public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null,
$only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null, $id_cart = null,
$id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, $context = null,
$use_customer_price = true, $id_customization = null)
{
$id_cart = ($id_cart == null || $id_cart == '') ? 0 : (int)$id_cart;

$price = parent::getPriceStatic($id_product, $usetax, $id_product_attribute, $decimals, $divisor,
$only_reduc, $usereduc, $quantity, $force_associated_tax, $id_customer, $id_cart,
$id_address, $specific_price_output, $with_ecotax, $use_group_reduction, $context,
$use_customer_price, $id_customization);

$cart = new Cart($id_cart);
if(Validate::isLoadedObject($cart) && $this->isUsDeliveryCart($cart)) {
$price = (float)Tools::ps_round($price * self::RATE, 2);
}

return $price;
}

/**
* Determine whether the cart's DELIVERY address is in the USA.
*/
protected function isUsDeliveryCart($cart)
{
if (!Validate::isLoadedObject($cart) || !(int)$cart->id_address_delivery) {
return false;
}

$address = new Address((int)$cart->id_address_delivery);
return Validate::isLoadedObject($address)
&& (int)$address->id_country === (int)self::US_COUNTRY_ID;
}
}