php - How to get content on a blank basketcart page in a custom theme with woocommerce

I'm working on an e-commerce site with a custom theme and I have been trying to integrate it with woocommerece, the

I'm working on an e-commerce site with a custom theme and I have been trying to integrate it with woocommerece, the shop and product page display just fine and work the way they should but when I go to the basket/cart page, it's blank the HTML is exactly this

<html>
  <head></head>
  <body></body>
</html>

Things I've checked/done so far

  • Basket page is present (generated by woocommerce).
  • Basket page has [woocommerce_cart] short code.
  • Woocommerce is configured to use this page.
  • I changed my theme to twentytwenty and the basket page shows up just fine but if I revert to my theme, the blank page situation reappears
  • If I add page-basket.php to my theme and add some content to it like a header with hello in it, it shows up just fine
  • Tried deleting the basket page and regenerating it but no dice.
  • Turned on debug logs but nothing is there.
  • Removed the woocommerce folder under my theme and reload page but still nothing.

I don't know if this is relevant but I copied all of the contents of the templates folder under the woocommerce plugin into MYTHEME/woocommerce. I also copied the same folder into the twentytwenty theme but it still works.

I'm on woocommerce 4.0.1

I have no idea what this could be and I'm stumped, any suggestions would be welcome

EDIT: I've also looked at the twentytwenty source and I cannot see how they are implementing woocommerce support, there's no reference to woocommerce at all.

EDIT: I also have woocommerce support in my theme

function add_woocommerce_support()
{
   add_theme_support('woocommerce');
}

add_action('after_setup_theme', 'add_woocommerce_support');

I'm working on an e-commerce site with a custom theme and I have been trying to integrate it with woocommerece, the shop and product page display just fine and work the way they should but when I go to the basket/cart page, it's blank the HTML is exactly this

<html>
  <head></head>
  <body></body>
</html>

Things I've checked/done so far

  • Basket page is present (generated by woocommerce).
  • Basket page has [woocommerce_cart] short code.
  • Woocommerce is configured to use this page.
  • I changed my theme to twentytwenty and the basket page shows up just fine but if I revert to my theme, the blank page situation reappears
  • If I add page-basket.php to my theme and add some content to it like a header with hello in it, it shows up just fine
  • Tried deleting the basket page and regenerating it but no dice.
  • Turned on debug logs but nothing is there.
  • Removed the woocommerce folder under my theme and reload page but still nothing.

I don't know if this is relevant but I copied all of the contents of the templates folder under the woocommerce plugin into MYTHEME/woocommerce. I also copied the same folder into the twentytwenty theme but it still works.

I'm on woocommerce 4.0.1

I have no idea what this could be and I'm stumped, any suggestions would be welcome

EDIT: I've also looked at the twentytwenty source and I cannot see how they are implementing woocommerce support, there's no reference to woocommerce at all.

EDIT: I also have woocommerce support in my theme

function add_woocommerce_support()
{
   add_theme_support('woocommerce');
}

add_action('after_setup_theme', 'add_woocommerce_support');
Share Improve this question edited Apr 14, 2020 at 21:43 Sangoma asked Apr 13, 2020 at 11:52 SangomaSangoma 13 bronze badges 2
  • did you add add_theme_support( 'woocommerce' ); in after_setup_theme action hook in your theme's functions.php file ? – Chetan Vaghela Commented Apr 13, 2020 at 12:02
  • Yes I have, I'll add that to the question, I've also discovered that basket is not the only page that is affected by this issue – Sangoma Commented Apr 13, 2020 at 12:04
Add a comment  | 

1 Answer 1

Reset to default 0

I ended up reintroducing my page-basket.php to my project and adding the line below to it and everything worked out just fone.

<?php echo do_shortcode("[woocommerce_cart]"); ?>

I don't know if this is the correct way to do things but it works

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742322736a4422137.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信