Automattic\WooCommerce\Blocks\BlockTypes

MiniCartFooterBlock::get_totals_item_descriptionprivateWC 1.0

Computes the total items description text based on which settings are enabled.

Method of the class: MiniCartFooterBlock{}

No Hooks.

Returns

String. The description text for the total items, or empty string if none are enabled.

Usage

// private - for code of main (parent) class only
$result = $this->get_totals_item_description();

MiniCartFooterBlock::get_totals_item_description() code WC 10.7.0

private function get_totals_item_description() {
	$taxes_enabled    = wc_tax_enabled();
	$shipping_enabled = wc_shipping_enabled();
	$coupons_enabled  = wc_coupons_enabled();

	// All three enabled.
	if ( $taxes_enabled && $shipping_enabled && $coupons_enabled ) {
		return __(
			'Shipping, taxes, and discounts calculated at checkout.',
			'woocommerce'
		);
	}

	// Shipping + taxes.
	if ( $shipping_enabled && $taxes_enabled ) {
		return __(
			'Shipping and taxes calculated at checkout.',
			'woocommerce'
		);
	}

	// Shipping + discounts.
	if ( $shipping_enabled && $coupons_enabled ) {
		return __(
			'Shipping and discounts calculated at checkout.',
			'woocommerce'
		);
	}

	// Taxes + discounts.
	if ( $taxes_enabled && $coupons_enabled ) {
		return __(
			'Taxes and discounts calculated at checkout.',
			'woocommerce'
		);
	}

	// Only shipping.
	if ( $shipping_enabled ) {
		return __( 'Shipping calculated at checkout.', 'woocommerce' );
	}

	// Only taxes.
	if ( $taxes_enabled ) {
		return __( 'Taxes calculated at checkout.', 'woocommerce' );
	}

	// Only discounts.
	if ( $coupons_enabled ) {
		return __( 'Discounts calculated at checkout.', 'woocommerce' );
	}

	// None enabled.
	return '';
}