[ad_1]
Hi,
je cherche un moyen de rajouter le suffice TTC après l’affichage du prix.
J’ai trouvé une solution en modifiant le fichier “price.php” dans “loop” mais dans la fonction cacher le prix si le client n’est pas connecté il me cache que le prix et me laisse le ttc.
code in price.php
<?php if ( $price_html = $product->get_price_html() ) : ?>
<span class="price"><?php echo $price_html; ?></br><?php if ( is_user_logged_in() ) echo wc_price( $product->get_price_including_tax() );?></span>
<?php endif; ?>Code pour cacher les prix
add_filter( 'woocommerce_get_price_html', 'storeapps_hide_price_addcart_not_logged_in', 9999, 2 );
function storeapps_hide_price_addcart_not_logged_in( $price="", $product ) {
if ( is_user_logged_in() ) {
return $price;
}
$price="<div class="price-container"><a class="hide-price" href="" . get_permalink( get_page_by_title( 'Inscription / Connexion' ) ) . '">' . __( 'Consulter les prix', 'storeapps' ) . '</a></div>';
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
return $price;
}Do you have a solution to my problem ? thanks
The page I need help with: [log in to see the link]
