-
-
Notifications
You must be signed in to change notification settings - Fork 56
WooCommerce template throws error #3
Comments
Can you show the content of your |
It's kind of strange... But even if I keep just
in the template file... It throws an error. The only thing that works is if I keep the template file empty. |
Does it work if you use the full contents of the default PHP template from WooCommerce? |
No. It only works if I keep the template file empty. |
Hey, you should not use Also, those templates are called without context, so no @php
$__env = App\sage('blade');
wc_print_notices();
do_action( 'woocommerce_before_cart' );
@endphp
<form class="woocommerce-cart-form" action="{{ wc_get_cart_url() }}" method="post">
@php
do_action( 'woocommerce_before_cart_table' );
@endphp
<table class="shop_table shop_table_responsive cart woocommerce-cart-form__contents" cellspacing="0">
<thead>
<tr>
<th class="product-remove"> </th>
<th class="product-thumbnail"> </th>
<th class="product-name">{{ esc_html_e( 'Product', 'woocommerce' ) }}</th>
<th class="product-price">{{ esc_html_e( 'Price', 'woocommerce' ) }}</th>
<th class="product-quantity">{{ esc_html_e( 'Quantity', 'woocommerce' ) }}</th>
<th class="product-subtotal">{{ esc_html_e( 'Total', 'woocommerce' ) }}</th>
</tr>
</thead>
<tbody>
@php
do_action( 'woocommerce_before_cart_contents' );
@endphp
@php
$items = WC()->cart->get_cart();
@endphp
@foreach($items as $cart_item)
@php
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $loop->index );
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $loop->index );
@endphp
...
@endforeach
@php
do_action( 'woocommerce_cart_contents' );
@endphp
...
@php
do_action( 'woocommerce_after_cart_contents' );
@endphp
</tbody>
</table>
@php
do_action( 'woocommerce_after_cart_table' );
@endphp
</form>
<div class="cart-collaterals">
@php
do_action( 'woocommerce_cart_collaterals' );
@endphp
</div>
@php
do_action( 'woocommerce_after_cart' );
@endphp |
Ok, investigation done. If you append following code at the beginning of the @php
$__env = App\sage('blade');
@endphp |
like every |
Now it's working... Thanks just removing the item is not working |
Bug is solved by #5 |
I'm having the same problem with the latest version of this package and woo 3.5.4. Is the @extends method fixed or it's still not recommended? |
Hey @arthurkirkosa - can you provide more detail on what you're trying to do, e.g., what template you're editing? AFAIK the correct approach is still what @mejta indicated above:
|
With @mejta 's approach works. Was wondering if that's the only way to do it. If so, I'm already doing it :) |
I am not able to make the
cart/cart.blade.php
work.it Throws error
The text was updated successfully, but these errors were encountered: