Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Last active March 3, 2026 08:09
Show Gist options
  • Select an option

  • Save xlplugins/827f0061893fa89637a02cbd3b8de54f to your computer and use it in GitHub Desktop.

Select an option

Save xlplugins/827f0061893fa89637a02cbd3b8de54f to your computer and use it in GitHub Desktop.
FKCart WooRewards (Loyalty)
// Load WR assets on all pages (plugin normally only loads on cart/checkout)
add_action( 'wp_enqueue_scripts', function() {
if ( is_admin() || ( function_exists( 'is_checkout' ) && is_checkout() ) ) {
return;
}
if ( ! class_exists( '\FKCart\Includes\Data' ) || ! \FKCart\Includes\Data::is_cart_enabled( 'all' ) ) {
return;
}
if ( ! defined( 'LWS_WOOREWARDS_VERSION' ) ) {
return;
}
wp_enqueue_script( 'lws_wr_pointsoncart' );
wp_enqueue_style( 'lws_wr_pointsoncart_hard' );
wp_enqueue_style( 'lws_wr_pointsoncart_custom' );
wp_add_inline_style( 'lws_wr_pointsoncart_custom', '
#fkcart-modal .lwss_selectable h2{font-size:14px;line-height:1.3;margin-bottom: 8px;}
#fkcart-modal .lwss_selectable .wr-cart-input .wr-cart-use-label span,span.lwss_modify_content,.lwss_selectable.wr-cart-balance-value,.lwss_selectable.wr-cart-use-label{font-size: 12px;line-height:16px}
#fkcart-modal .lwss_selectable.wr-cart-balance-value, .lwss_selectable.wr-cart-balance-label{line-height:20px}
#fkcart-modal .lwss_selectable.wr-input-amount{height:24px}
#fkcart-modal .fkcart-woorewards-wrap.fkcart-panel{padding:0}
#fkcart-modal button.button{
padding: 8px 12px;
height: 30px;
}
' );
}, 20 );
// Hook shortcode into slide cart
add_action( 'fkcart_after_order_summary', function() {
wc_maybe_define_constant( 'WOOCOMMERCE_CART', true );
$html = do_shortcode( '[wr_points_on_cart showall="yes"]' );
if ( ! empty( trim( strip_tags( $html ) ) ) ) {
echo '<div class="fkcart-woorewards-wrap fkcart-panel">' . $html . '</div>';
}
}, 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment