Last active
May 25, 2026 11:07
-
-
Save xlplugins/7b5600ca7b7e28b5234678b6b29f8a1b to your computer and use it in GitHub Desktop.
override product link for fkcart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'fkcart_enable_item_link', function ( $show, $cart_item_key, $cart_item ) { | |
| add_filter( 'woocommerce_cart_item_permalink', 'fkcart_custom_permalink', 10, 3 ); | |
| return $show; | |
| }, 10, 3 ); | |
| function fkcart_custom_permalink( $permalink, $cart_item, $cart_item_key ) { | |
| remove_filter( 'woocommerce_cart_item_permalink', 'fkcart_custom_permalink', 10 ); | |
| $urls = array( | |
| 123 => 'https://example.com/page-a/', | |
| 456 => 'https://example.com/page-b/', | |
| ); | |
| if ( isset( $urls[ $cart_item['product_id'] ] ) ) { | |
| $permalink = $urls[ $cart_item['product_id'] ]; | |
| } | |
| return $permalink; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment