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
| if ( ! defined( 'ABSPATH' ) ) { | |
| exit; | |
| } | |
| $allowed_offer_ids = array( 123 , 2487 ); | |
| add_action( 'wfocu_add_custom_html_above_accept_button', function( $product_id, $product_key ) use ( $allowed_offer_ids ) { | |
| $offer_id = WFOCU_Core()->data ? WFOCU_Core()->data->get( 'current_offer' ) : 0; | |
| $offer_id = $offer_id ?: get_the_ID(); | |
| if ( ! in_array( (int) $offer_id, $allowed_offer_ids, true ) ) { |
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
| if ( ! defined( 'ABSPATH' ) ) exit; | |
| add_filter( 'woocommerce_coupon_discount_amount_html', function( $h, $c ) { | |
| if ( ! $c || ! WC()->cart || (float) WC()->cart->get_coupon_discount_amount( $c->get_code(), WC()->cart->display_cart_ex_tax ) > 0 ) return $h; | |
| $code = strtolower( $c->get_code() ); $m = \Wdr\App\Controllers\ManageDiscount::class; | |
| $v = $m::$apply_as_coupon_values[ $code ]['value'] ?? null; | |
| if ( $v === null ) foreach ( $m::$applied_cart_coupon_discounts ?? [] as $x ) { if ( strtolower( $x['name'] ?? '' ) === $code ) { $v = $x['value']; break; } } | |
| if ( $v === null && count( WC()->cart->get_applied_coupons() ) === 1 ) { | |
| $v = 0; |
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_reward_total', 'fkcart_rewards_total_fallback', 999, 3 ); | |
| function fkcart_rewards_total_fallback( $total, $calculation_mode, $front ) { | |
| if ( 'total' !== $calculation_mode ) { | |
| return $total; | |
| } | |
| if ( is_null( WC()->cart ) || WC()->cart->is_empty() ) { | |
| return $total; | |
| } | |
| // Only fallback when total is 0 or negative but cart has items |
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_reward_total', 'fkcart_rewards_total_fallback', 999, 3 ); | |
| function fkcart_rewards_total_fallback( $total, $calculation_mode, $front ) { | |
| if ( 'total' !== $calculation_mode ) { | |
| return $total; | |
| } | |
| if ( is_null( WC()->cart ) || WC()->cart->is_empty() ) { | |
| return $total; | |
| } | |
| // Only fallback when total is 0 or negative but cart has items |
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
| /** | |
| * Product Addons + FKCart: Fix duplicate checkbox/switch IDs in quick view. | |
| * Uses: prad_block_rendered (Product Addons), fkcart_cart_quick_view_open (FKCart). | |
| */ | |
| add_filter( 'prad_block_rendered', function ( $html, $block, $product_id ) { | |
| if ( ! ( wp_doing_ajax() && ( ( isset( $_GET['wc-ajax'] ) && 'fkcart_quick_view' === $_GET['wc-ajax'] ) || ( isset( $_REQUEST['action'] ) && 'fkcart_quick_view' === $_REQUEST['action'] ) ) ) ) { | |
| return $html; | |
| } | |
| if ( ! preg_match( '/data-bid=["\']([^"\']+)["\']/', $html, $m ) ) { | |
| return $html; |
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
| /** | |
| * Upsell short description: show below product name (no layout changes) | |
| */ | |
| add_action( 'fkcart_before_upsell_price', function( $product_id, $cart_item ) { | |
| if ( isset( $cart_item['product'] ) && $cart_item['product'] instanceof WC_Product ) { | |
| $short_desc = $cart_item['product']->get_short_description(); | |
| if ( ! empty( $short_desc ) ) { | |
| echo '<div class="fkcart-upsell-short-description">' . wp_kses_post( $short_desc ) . '</div>'; | |
| } |
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
| if ( ! defined( 'ABSPATH' ) ) { | |
| exit; | |
| } | |
| add_action( 'wfocu_offer_new_order_created', 'fkwcs_update_stripe_intent_for_upsell_order', 20, 2 ); | |
| function fkwcs_update_stripe_intent_for_upsell_order( $new_order, $txn_id ) { | |
| try { | |
| if ( ! $new_order instanceof WC_Order ) { | |
| return; |
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
| /** | |
| * Plugin Name: WFACP Shipping Layout - One by One | |
| * Description: Snippet-only. Block-style shipping (name, est, price on separate lines). No core edits. | |
| */ | |
| if ( ! defined( 'ABSPATH' ) ) { | |
| exit; | |
| } | |
| add_filter( 'woocommerce_cart_shipping_method_full_label', 'wfacp_shipping_label_split', 10, 2 ); |
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
| /** | |
| * Plugin Name: WFACP Shipping Layout - One by One | |
| * Description: Snippet-only. Block-style shipping (name, est, price on separate lines). No core edits. | |
| */ | |
| if ( ! defined( 'ABSPATH' ) ) { | |
| exit; | |
| } | |
| add_filter( 'woocommerce_cart_shipping_method_full_label', 'wfacp_shipping_label_split', 10, 2 ); |
NewerOlder