woocommerce_cart_item_permalink хук-фильтрWC 9.9.0

Filter the product permalink.

This is a hook taken from the legacy cart/mini-cart templates that allows the permalink to be changed for a product. This is specific to the cart endpoint.

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

add_filter( 'woocommerce_cart_item_permalink', 'wp_kama_woocommerce_cart_item_permalink_filter', 10, 3 );

/**
 * Function for `woocommerce_cart_item_permalink` filter-hook.
 * 
 * @param string $product_permalink Product permalink.
 * @param array  $cart_item         Cart item array.
 * @param string $cart_item_key     Cart item key.
 *
 * @return string
 */
function wp_kama_woocommerce_cart_item_permalink_filter( $product_permalink, $cart_item, $cart_item_key ){

	// filter...
	return $product_permalink;
}
$product_permalink(строка)
Product permalink.
$cart_item(массив)
Cart item array.
$cart_item_key(строка)
Cart item key.

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

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

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

CartItemSchema::get_item_response()
woocommerce_cart_item_permalink
woocommerce/src/StoreApi/Schemas/V1/CartItemSchema.php 48
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $product->get_permalink(), $cart_item, $cart_item['key'] );
woocommerce/templates/cart/cart.php 54
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
woocommerce/templates/cart/mini-cart.php 43
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );

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

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