woocommerce_cart_item_permalink
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.
Usage
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(string)
- Product permalink.
- $cart_item(array)
- Cart item array.
- $cart_item_key(string)
- Cart item key.
Changelog
Since 9.9.0 | Introduced. |
Where the hook is called
woocommerce_cart_item_permalink
woocommerce/src/StoreApi/Schemas/V1/CartItemSchema.php 52
$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 );