Forum
Hide stripe pay button when cart empty
When I empty my cart the stripe pay by card button is still visible at the bottom. Clicking on it brings up the modal asking you to pay for £0. I'm using this as taken from the docs:
<?php
// Show the cart
perch_shop_cart([
'template'=>'cart/cart.html'
]);
// Show the order addresses
perch_shop_order_addresses();
// Show the payment form
perch_shop_payment_form('stripe');
?>
I copied and opened the stripe payment form template and wrapped it with <perch:if id="product_count" match="gt" value="0">...</perch:if> but that doesn't seem to work.
Is
product_count
a value in that template? (It won't be unless you pass it in)No it isn't. How would I pass it in? And is that the best way go about it?
You can get the total number of items in the cart with
perch_shop_cart_item_count()