Created
September 20, 2024 12:05
-
-
Save xlplugins/73bae05c1f9fcb546d19eb49b17d2fef to your computer and use it in GitHub Desktop.
Funnelkit Cart: compatbility with Discount Rules Core by Flycart 2.6.6
This file contains 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
class FKCART_Woo_Discount_Rule { | |
public function __construct() { | |
add_filter( 'fkcart_enable_item_link', [ $this, 'add_item_meta' ] ); | |
} | |
public function add_item_meta( $status ) { | |
if ( ! $this->is_enable() ) { | |
return $status; | |
} | |
add_filter( 'woocommerce_cart_item_subtotal', array( $this, 'cart_loaded' ), 99999, 3 ); | |
return $status; | |
} | |
public function cart_loaded( $price, $cart_item, $cart_item_key ) { | |
$regular_price = Wdr\App\Router::$manage_discount->getCartPriceHtml( $price, $cart_item, $cart_item_key ); | |
if ( ! empty( $regular_price ) ) { | |
return $regular_price; | |
} | |
return $price; | |
} | |
public function is_enable() { | |
return class_exists( 'Wdr\App\Router' ); | |
} | |
} | |
new FKCART_Woo_Discount_Rule(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment