What happens if i use pure php in blade template?

I am integrating woocommerce. But in some files, i use only php code. Is it changes something or is it bad way?

No, it’s fine to use plain PHP inside Blade. Eventually all Blade views are compiled into plain PHP.

2 Likes

Hey @bilalmalkoc,

Yep, as @jasonbaciulis said, you can put normal PHP in Blade files. if you’re using only PHP and no Blade syntax, then you might want to name the files just .php instead of .blade.php (they should still work just fine).

Also, re WooCommerce, take a look here in case it’s helpful for you. https://github.com/roots/sage-woocommerce

Thank you for answer. i am already using this.

1 Like

Hi guys. We’re also interested in getting a WooCommerce integration going.

Are there any non-customized Sage-integrated WooCommerce template packages available somewhere? I’m looking for nothing custom, just upstream templates, that have been prepared for plug n play operation with Sage.

Hey @lkraav - our sage-woocommerce repository has a couple of example files, but not a wide range. https://github.com/roots/sage-woocommerce/tree/master/examples/resources/views/woocommerce. That may be enough to get you started, especially if you don’t need to override many of the templates.

I know some other Discourse users have posted links to their own files / repositories, so searching here for WooCommerce may help you find some more options. Not sure if any would be immediately compatible with roots/sage-woocommerce (though of course you don’t have to use our project to use WooCommerce with Sage).

1 Like