0

Building custom theme with WooCommerce support. On the checkout page, I'm getting an error that the checkout variable is undefined. Looking into where this is used, I find that form-checkout.php in the WooCommerce plugin has:

do_action( 'woocommerce_before_checkout_form', $checkout );

Great. I need $checkout, but not sure how to make sure the right info is passed.

Note - while this is a custom theme, the WooCommerce functionality should all be intact. Everything seems to work just fine up until this point, so I'm not sure if there's a problem in getting the info from my cart to the checkout page?

  • you are working in the file checkout/form-checkout.php ? when this file is called, this variable should be present then it's strange that you have a notice "Undefined variable". – mmm Nov 19 '17 at 22:35
0

Not sure why the shortcode in the content didn't take care of this, but hardcoding the relevant shortcode did the trick.

This code on my cart page was all I needed:

<?php echo do_shortcode('[woocommerce_checkout]'); ?>

I'm not satisfied with this answer, but it works for now so I'm going with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.