← Back
Editing: functions.php
<?php /** * Enqueue script and styles for child theme */ function woodmart_child_enqueue_styles() { wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'woodmart-style' ), woodmart_get_theme_info( 'Version' ) ); } add_action( 'wp_enqueue_scripts', 'woodmart_child_enqueue_styles', 10010 ); add_action( 'init', function() { // Remove the default WoodMart category display remove_action( 'woocommerce_after_shop_loop_item_title', 'woodmart_template_loop_category', 7 ); // Add the Short Description in its place add_action( 'woocommerce_after_shop_loop_item_title', function() { global $post; if ( has_excerpt( $post->ID ) ) { echo '<div class="custom-grid-description" style="font-size: 12px; color: #777;">'; echo get_the_excerpt(); echo '</div>'; } }, 7 ); }, 20 ); add_filter( 'woocommerce_get_price_html', 'custom_zero_price_clickable_link', 100, 2 ); function custom_zero_price_clickable_link( $price, $product ) { // Check if price is 0 or empty if ( $product->get_price() <= 0 ) { $phone_number = '+13106577000'; // Replace with your actual business number return sprintf( '<a href="tel:%1$s" class="call-for-price-link" style="color: var(--wd-primary-color); font-weight: bold;"> Call for pricing </a>', $phone_number ); } return $price; } add_filter( 'woocommerce_is_purchasable', 'remove_add_to_cart_on_zero_price', 10, 2 ); function remove_add_to_cart_on_zero_price( $purchasable, $product ) { if ( $product->get_price() <= 0 ) { return false; } return $purchasable; }
Save File
Cancel