skip to Main Content

For WooCommerce I create an own checkout page but I have an Issue.

The code $checkout->get_value( 'billing_first_name' ); does not work in my template file.

My file is called with `get_template_part( ‘temp-parts/content/pages/checkout-billing’); in the file woocommerce/checkout/form-billing.php

This generate an error

Call to a member function get_value() on null

If I use this code directly in the file woocommerce/checkout/form-billing.php the code does work.

Is it possible to get the checkout information in my own template?

2

Answers


  1. As $checkout variable is not defined, you should use instead:

    WC()->checkout->get_value( 'billing_first_name' );
    

    Now it will work.

    Login or Signup to reply.
  2. Use global $woocommerce and after that $woocommerce->checkout->get_value( 'billing_first_name' );

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search