WC_Gateway_Paypal::maybe_remove_fields
Filter to remove fields for Orders v2.
Method of the class: WC_Gateway_Paypal{}
No Hooks.
Returns
Array.
Usage
$WC_Gateway_Paypal = new WC_Gateway_Paypal(); $WC_Gateway_Paypal->maybe_remove_fields( $form_fields );
- $form_fields(array) (required)
- Form fields.
WC_Gateway_Paypal::maybe_remove_fields() WC Gateway Paypal::maybe remove fields code WC 10.5.0
public function maybe_remove_fields( $form_fields ) {
// Remove legacy setting fiels when using Orders v2.
if ( $this->should_use_orders_v2() ) {
foreach ( $form_fields as $key => $field ) {
if ( isset( $field['is_legacy'] ) && $field['is_legacy'] ) {
unset( $form_fields[ $key ] );
}
}
}
if ( ! $this->should_use_orders_v2() ) {
unset( $form_fields['paypal_buttons'] );
}
return $form_fields;
}