user3697484
user3697484

Reputation:

Error : credit_card_form is deprecated since version 2.6! Use > WC_Payment_Gateway_CC->form instead

I am using this code to generate the credit card form but it throws a notice that

credit_card_form is deprecated since version 2.6! Use WC_Payment_Gateway_CC->form instead.

public function payment_fields() {
          $this->credit_card_form();
        }

So how do i access that class as i am currently extending the WC_Payment_Gateway?

class GGOwl_Woo extends WC_Payment_Gateway {

Upvotes: 1

Views: 705

Answers (1)

rmbits
rmbits

Reputation: 2327

As suggested by deprecated method notice itself, you should use WC_Payment_Gateway_CC instead. You can use similar code yourself as used in WC_Payment_Gateway::credit_card_form. So you can replace $this->credit_card_form() with following:

$cc_form           = new WC_Payment_Gateway_CC();
$cc_form->id       = $this->id;
$cc_form->supports = $this->supports;
$cc_form->form();

This is just a workaround, you should actually extend your class from WC_Payment_Gateway_CC.

Upvotes: 3

Related Questions