Override an overriding function
-
Hi!
Been searching in the forums, but I can’t really find anything directly related to my question (and the forums are way harder to navigate nowadays).
I’m using a theme by Mikado called Cortex and woocommerce.
They’re using a function for overriding the regular “out of stock” badge and as you can see belo2, they’ve also overridden the text from “out of stock” to just “sold”. I find this a bit misleading.Now, I know I can change it in the theme functions file and wait for a theme update to erase it, but it’s not optimal so I’m looking for another solution.
I’ve been trying to find a function (because I’m not php-savvy, unfortunately) that overrides the text override to “sold out” or back to “out of stock”, without changing anything else with the badge.
if (!function_exists('cortex_mikado_woocommerce_out_of_stock_flash')) { /** * Function for overriding Out of Stock badge * * @return string */ function cortex_mikado_woocommerce_out_of_stock_flash() { global $product; $availability = $product->get_availability(); if ( !$product->is_in_stock() && WC_Admin_Settings::get_option( 'woocommerce_notify_no_stock')=='yes') { print apply_filters( 'woocommerce_stock_html', '<span class="mkdf-product-badge mkdf-out-of-stock ' . esc_attr( $availability['class'] ) . '"><span class="mkdf-product-badge-inner mkdf-out-of-stock-inner">' . esc_html__('Sold', 'cortex') . '</span></span>', $availability['availability'] ); } } }I have a custom-functions plugin installed, instead of a child theme, because I hardly ever change anything other than css.
Is this enough info for anyone to help me, or do I need to provide more?Kind regards!
The topic ‘Override an overriding function’ is closed to new replies.