Skip to content
d enhancements.
*/
add_action( 'woocommerce_before_shop_loop_item_title', 'mh_render_reference_product_card_tools', 7 );
function mh_render_reference_product_card_tools() {
global $product;
if ( ! $product || ! is_a( $product, 'WC_Product' ) ) {
return;
}
$product_id = $product->get_id();
echo '';
}
add_action( 'woocommerce_after_shop_loop_item_title', 'mh_render_reference_loop_price_saving', 11 );
function mh_render_reference_loop_price_saving() {
global $product;
if ( ! $product || ! is_a( $product, 'WC_Product' ) || ! $product->is_on_sale() ) {
return;
}
$percentage = mh_get_product_discount_percentage( $product );
if ( $percentage <= 0 ) {
return;
}
echo '' . esc_html( sprintf( __( 'Save %d%%', 'flatsome-child' ), absint( $percentage ) ) ) . '
';
}
add_action( 'flatsome_product_box_after', 'mh_render_reference_loop_unavailable_button', 6 );
function mh_render_reference_loop_unavailable_button() {
global $product;
if ( ! $product || ! is_a( $product, 'WC_Product' ) ) {
return;
}
if ( $product->is_in_stock() && $product->is_purchasable() ) {
return;
}
echo 'Not Available
';
}
add_action( 'wp_footer', 'mh_reference_product_card_behavior_script', 100 );
function mh_reference_product_card_behavior_script() {
if ( is_admin() ) {
return;
}
?>