Display advance payment message on cart page
-
Hello!
I have this function here that checks if a product from the “torturi” category is in the cart and if so display that you need to pay 10% for that product in advance.
I want to be able to display the actual amount for all of those products. For example if I have 2 products of the “torturi” category that cost $100 each display a message like: “You need to pay 10% ($20) in advance for the torturi” regardless if there is any product from a different category in the cart aswell. Is there any way to do it?add_action( ‘woocommerce_before_cart_contents’, ‘mesaj_torturi_cos’, 12 );
function mesaj_torturi_cos() {
$special_cat = ‘torturi’;
$bool = false;
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$item = $cart_item[‘data’];
if ( has_term( $special_cat, ‘product_cat’, $item->id ) )
$bool = true;
}
if ($bool)
echo ‘<p style=”margin-top: -15px; font-size: 20px; text-align: center;”>In cazul torturilor se percepe un avans de 10% (AMOUNT HERE). Greutatea torturilor poate varia cu ±200g.</p>’;
}
- The topic ‘Display advance payment message on cart page’ is closed to new replies.