Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / make_city_zipcode_optional.php
Last active August 22, 2025 14:04
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);
@xlplugins
xlplugins / add_separate_draggable_checkout_field.php
Created August 20, 2025 11:28
Add separate draggable checkout field
class WFACP_Custom_Field_In_Advanced {
public function __construct() {
/* Register Add field */
add_filter( 'wfacp_advanced_fields', [ $this, 'add_field' ], 20 );
}
public function add_field( $fields ) {
$fields['billing_company'] = [
@xlplugins
xlplugins / custom_script_under_head.php
Created August 18, 2025 09:11
custom_script_under_head.php
/**
* Print custom JS in <head> on all FunnelKit funnel step pages.
*/
function fb_print_funnelkit_head_js()
{
// Skip for admin or feeds
if (is_admin() || is_feed()) {
return;
}
@xlplugins
xlplugins / gist:6a811c02c3c24158bbfc5e26a27243b6
Created August 14, 2025 11:41
Fkcart Custom Html below the place order
class FKCART_Custom_Html_After_Button{
public function __construct() {
add_action('fkcart_after_checkout_button',[$this,'display_html']);
add_action('wp_footer',[$this,'add_js']);
}
public function display_html(){
?>
<div class="fkcart_custom_wrap">
@xlplugins
xlplugins / gist:b3060989af3037fc2735fefdb89923d0
Created August 14, 2025 07:17
Funnelkit Checkout: Billing Address Will be show at the top and hide the shipping field when dropdown field value will be pick up
class WFACP_Billing_Address_1_Custom_field {
protected $unset_key = "shipping";
protected $dropdown_key = "coderockz_woo_delivery_delivery_selection_box";
private $fields=[
'label' => 'Street address',
'placeholder' => '',
'required' => 'true',
'class' => [
'wfacp-form-control-wrapper ',
@xlplugins
xlplugins / Checkout : Add product ID in mini cart line item
Created August 13, 2025 11:29
Checkout : Add product ID in mini cart line item
class WFACP_Add_Bump_Product_class {
public function __construct() {
add_action( 'wfacp_template_load', [ $this, 'actions' ] );
}
public function actions() {
add_action( 'woocommerce_cart_item_class', [ $this, 'add_cart_item_class' ], 12, 3 );
}
public function add_cart_item_class($class, $cart_item, $cart_item_key){
@xlplugins
xlplugins / Checkout : hide "Free" when shipping cost is zero-free
Created August 13, 2025 10:10
Checkout : hide "Free" when shipping cost is zero-free
add_action( 'wfacp_before_process_checkout_template_loader', 'add_wfacp_action' );
add_action( 'wfacp_checkout_page_found', 'add_wfacp_action' );
function add_wfacp_action() {
add_filter( 'wc_cart_totals_shipping_method_cost', 'check_shipping_cost', 99, 2 );
}
function check_shipping_cost( $output, $method ) {
$has_cost = $method->cost;