Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created April 7, 2025 13:37
Show Gist options
  • Save xlplugins/723bafaece93aee43db782ee6794bd8c to your computer and use it in GitHub Desktop.
Save xlplugins/723bafaece93aee43db782ee6794bd8c to your computer and use it in GitHub Desktop.
Funnelkit Checkout: Unset Shipping Address 2 field on the checkout page
class WFACP_WooCommerce_Field_Modifier {
private $unset_fields = [ 'shipping_address_2' ];
public function __construct() {
// Remove 'shipping_address_2' field
add_filter( 'wfacp_forms_field', [ $this, 'remove_required_fields' ], 9999, 10, 2 );
}
// Method to remove required fields
public function remove_required_fields( $fields, $key ) {
if (is_array($this->unset_fields) && count($this->unset_fields) > 0&& in_array( $key, $this->unset_fields ) ) {
return [];
}
return $fields; // Return fields as they are
}
}
// Instantiate the class to hook into the filter
new WFACP_WooCommerce_Field_Modifier();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment