Код: Выделить всё
add_action( 'woocommerce_before_calculate_totals', 'bis_recalc_price', 10 );
Код: Выделить всё
$customerArray=api_authCustomer(API_CUSTOMER_NAME, API_PASSORD);
foreach ($cart_object->get_cart() as $hash => $value) {
if(isset($_COOKIE['wt_customerID'])) {
$_product = $value['data'];
$is_on_sale = $value['data']->is_on_sale();
$bisProductArray = api_getProductByIDonly($_product->get_sku(), $customerToken);
$SellPerText = $bisProductArray[0][0]['SellPerText'];
$custID = $_COOKIE['wt_customerID'];
$prodID = get_meta('bis_prodID', true);
$prodID = get_post_meta($value['data']->get_id(),'bis_prodID', true);
if ($prodID > 0) {
$priceStockArray = api_customerpriceandstocklevel($custID, $prodID, $SellPerText, $customerToken);
$customer_price=$priceStockArray[0]['CustomerPrice'][0]['UnitSellPrice'];
if ( $is_on_sale and ($_product->get_sale_price()>0)) {
if ($customer_price > $_product->get_sale_price()) {
$customer_price = $_product->get_sale_price();
}
}
$value['data']->set_price($customer_price);
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... efinitions
Мобильная версия