woocommerce_cart_(_FUNCTION__) хук-фильтрWC 3.2.0

Gets cart total. This is the total of items in the cart, but after discounts. Subtotal is before discounts.

Использование

add_filter( 'woocommerce_cart_(_FUNCTION__)', 'wp_kama_woocommerce_cart__FUNCTION_filter' );

/**
 * Function for `woocommerce_cart_(_FUNCTION__)` filter-hook.
 * 
 * @param  $totals_var 
 *
 * @return 
 */
function wp_kama_woocommerce_cart__FUNCTION_filter( $totals_var ){

	// filter...
	return $totals_var;
}
$totals_var
-

Список изменений

С версии 3.2.0 Введена.

Где вызывается хук

WC_Cart::get_cart_contents_total()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_subtotal()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_subtotal_tax()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_discount_total()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_discount_tax()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_shipping_total()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_shipping_tax()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_cart_contents_tax()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_total()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_total_tax()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_fee_total()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_fee_tax()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_shipping_taxes()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_cart_contents_taxes()
woocommerce_cart_(_FUNCTION__)
WC_Cart::get_fee_taxes()
woocommerce_cart_(_FUNCTION__)
WC_Cart::display_prices_including_tax()
woocommerce_cart_(_FUNCTION__)
woocommerce/includes/class-wc-cart.php 273
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'cart_contents_total' ) );
woocommerce/includes/class-wc-cart.php 213
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'subtotal' ) );
woocommerce/includes/class-wc-cart.php 223
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'subtotal_tax' ) );
woocommerce/includes/class-wc-cart.php 233
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'discount_total' ) );
woocommerce/includes/class-wc-cart.php 243
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'discount_tax' ) );
woocommerce/includes/class-wc-cart.php 253
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'shipping_total' ) );
woocommerce/includes/class-wc-cart.php 263
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'shipping_tax' ) );
woocommerce/includes/class-wc-cart.php 283
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'cart_contents_tax' ) );
woocommerce/includes/class-wc-cart.php 294
$total = apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'total' ) );
woocommerce/includes/class-wc-cart.php 305
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'total_tax' ) );
woocommerce/includes/class-wc-cart.php 315
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'fee_total' ) );
woocommerce/includes/class-wc-cart.php 325
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'fee_tax' ) );
woocommerce/includes/class-wc-cart.php 334
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'shipping_taxes' ) );
woocommerce/includes/class-wc-cart.php 343
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'cart_contents_taxes' ) );
woocommerce/includes/class-wc-cart.php 352
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'fee_taxes' ) );
woocommerce/includes/class-wc-cart.php 362
return apply_filters( 'woocommerce_cart_' . __FUNCTION__, 'incl' === $this->get_tax_price_display_mode() );

Где используется хук в WooCommerce

woocommerce/includes/class-wc-cart-session.php 72
add_action( 'woocommerce_cart_emptied', array( $this, 'destroy_cart_session' ) );
woocommerce/includes/class-wc-cart-session.php 74
add_action( 'woocommerce_cart_loaded_from_session', array( $this, 'set_session' ) );
woocommerce/includes/class-wc-cart-session.php 79
add_action( 'woocommerce_cart_item_removed', array( $this, 'persistent_cart_update' ) );
woocommerce/includes/class-wc-cart-session.php 80
add_action( 'woocommerce_cart_item_restored', array( $this, 'persistent_cart_update' ) );
woocommerce/includes/class-wc-cart-session.php 81
add_action( 'woocommerce_cart_item_set_quantity', array( $this, 'persistent_cart_update' ) );
woocommerce/includes/class-wc-cart.php 110
add_action( 'woocommerce_cart_item_removed', array( $this, 'calculate_totals' ), 20, 0 );
woocommerce/includes/class-wc-cart.php 111
add_action( 'woocommerce_cart_item_restored', array( $this, 'calculate_totals' ), 20, 0 );
woocommerce/includes/wc-template-hooks.php 245
add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
woocommerce/includes/wc-template-hooks.php 246
add_action( 'woocommerce_cart_collaterals', 'woocommerce_cart_totals', 10 );
woocommerce/includes/wc-template-hooks.php 249
add_action( 'woocommerce_cart_is_empty', 'wc_empty_cart_message', 10 );
woocommerce/includes/wc-template-hooks.php 310
add_action( 'woocommerce_cart_is_empty', 'woocommerce_output_all_notices', 5 );