Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / gist:e9a239a1d8fd89d9e403b9a8ef4ba342
Created September 2, 2025 10:23
Funnelkit Checkout: Custom Validation on the billing_codice_fiscale
class WFACP_CodiceFiscaleValidator
{
private $field_name = 'billing_codice_fiscale';
private $pattern = '/^[A-Z]{6}[0-9]{2}[A-Z]{1}[0-9]{2}[A-Z]{1}[0-9]{3}[A-Z]{1}$/';
public function __construct($field_name = 'billing_codice_fiscale')
{
$this->field_name = $field_name;
$this->init();
}
@xlplugins
xlplugins / gist:46e3cfcfc53a892de677d611a0533e26
Created September 2, 2025 09:20
Funnelkit Cart Refresh on Rymera Add to Cart
class FK_Rymera_Cart_Integration {
public function __construct() {
// Hook into wp_footer to output the JS
add_action( 'wp_footer', [ $this, 'enqueue_custom_js' ] );
}
/**
* Print inline JS in the footer.
*/
@xlplugins
xlplugins / gist:4cfeed671a8868803280115150c98161
Created September 1, 2025 13:28
Funnelkit Cart: Trigger Update Side cart when Open Slide cart
class FKCART_Trigger_Add_To_cart_On_Slide_Cart {
public function __construct() {
add_action( 'wp_footer', [ $this, 'add_js' ] );
}
public function add_js() {
?>
<script>
window.addEventListener('load', function () {
@xlplugins
xlplugins / gist:c61ed2d1d5eb501255c9057d36d576aa
Created August 29, 2025 07:33
Funnelkit Cart: Display Custom Notice of backorder Message
class FKCART_Notices_Handler {
public function __construct() {
add_action( 'fkcart_quick_before_view_content', [ $this, 'remove_action' ],99 );
}
function remove_action() {
?>
<style>
#fkcart-modal .fkcart-quick-view-drawer .fkcart-product-form-wrap .woocommerce-variation p.stock {
@xlplugins
xlplugins / gist:7e6b72e467787dc7a38034bbcfa3f6e8
Last active August 28, 2025 05:57
Funnelkit Cart: Display Cart Notice of Free Gifts for WooCommerce by Flintop
class FKCART_Display_Cart_Notice_Free_Gifts_for_WC {
private static $instance = null;
public function __construct() {
add_action('fkcart_after_header', [$this, 'display_cart_gift_notice']);
add_action('wp_footer', [$this, 'add_js']);
}
// Singleton pattern to prevent multiple instances
@xlplugins
xlplugins / gist:3bc7435392ab9d2a02612cdfd775ad2c
Created August 26, 2025 12:52
Funnelkit Checkout: Theme notice styling issue resolved
add_action('wfacp_internal_css',function(){
?>
<style>
body #wfacp-e-form .wfacp_main_form.woocommerce .shipping-notice.woocommerce-info{
position: relative;
font-size: 1em !important;
color: inherit;
background: none;
border-top: 1px solid #eee !important;
@xlplugins
xlplugins / make_city_zipcode_optional.php
Last active August 23, 2025 14:28
Make postcode and city optional for Romania
add_filter( 'woocommerce_get_country_locale', function ( $locale ) {
$ARR = [ 'RO' ];
foreach ( $ARR as $country_code ) {
$locale[ $country_code ]['postcode'] = array(
'required' => false,
);
}
return $locale;
@xlplugins
xlplugins / Custom field by Code (2)
Created August 21, 2025 14:35
Custom field by Code (2)
class WFACP_ADD_Custom_Fields_Under_Billing_Shipping {
public function __construct() {
add_action( 'after_setup_theme', [ $this, 'setup_fields_billing' ] );
add_action( 'wfacp_after_checkout_page_found', [ $this, 'action' ] );
}
public function action(){
add_filter( 'woocommerce_form_field_args', [ $this, 'add_default_wfacp_styling' ], 10, 2 );
@xlplugins
xlplugins / ShipStation code snippet
Created August 21, 2025 11:54
ShipStation code snippet
//classic checkout
add_action( 'woocommerce_checkout_create_order', 'add_wholesale_meta_to_order', 10, 2 );
//woocommerce checkout blocks
add_action( 'woocommerce_store_api_checkout_update_order_meta', 'new_add_wholesale_meta_to_order');
function add_wholesale_meta_to_order( $order, $context ) {
global $wc_wholesale_prices;
if ( ! isset( $wc_wholesale_prices->wwp_wholesale_roles ) ) {
return;
@xlplugins
xlplugins / gist:06bbfd503d002a70ad90b38477dab1cd
Last active August 21, 2025 05:15
Funnelkit Cart: Change the size of upsell image
class FKCART_Change_Upsell_Thumbnail_Image{
public function __construct() {
add_filter('fkcart_upsell_thumbnail_image',[$this,'change_thumbnail_image'],11,2);
add_action('fkcart_after_modal_container',[$this,'add_css'],11,2);
}
public function change_thumbnail_image($image,$cart_item){
if (isset($cart_item['product_id'])) {
$product_id = $cart_item['product_id'];
$attachment_id = get_post_thumbnail_id($product_id);