Friday, October 7, 2022
HomeWordPress Developmentphp - Including a checkout discipline within woocommerce cart web page

php – Including a checkout discipline within woocommerce cart web page


I’m working with Woocommerce with webhooks. On the checkout web page, by utilizing

woocommerce_form_field

I can add a customized checkout discipline. Nevertheless, when I attempt to add the custom-made checkout web page on the cart web page (the web page earlier than the checkout web page that permits one so as to add or delete merchandise), an error happens. Has anybody made a custom-made checkout discipline for the cart web page?

Right here is my code for the checkout web page:

add_action('woocommerce_before_checkout_billing_form', 'custom_checkout_username', 1);

// FOR USERNAME
operate custom_checkout_username($checkout)

{
    
woocommerce_form_field('custom_field_username', array(

'sort' => 'textual content',

'class' => array(

'my-field-class form-row-wide'

) ,

'required' => true,

'label' => ('Username') ,


'placeholder' => ('Kind in your username') ,

) ,

$checkout->get_value('custom_field_username'));

}

The one variations I made when making an attempt to stick the code to run on the cart web page was altering woocommerce_before_checkout_billing_form to woocommerce_before_cart, and altering the operate custom_checkout_username to custom_checkout_username2.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments