Created
April 7, 2025 13:37
-
-
Save xlplugins/723bafaece93aee43db782ee6794bd8c to your computer and use it in GitHub Desktop.
Funnelkit Checkout: Unset Shipping Address 2 field on the checkout page
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
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