Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    1 – Follow the topic from the woocommerce support – https://www.ads-software.com/support/topic/change-out-of-stock-text-to-previously-sold/

    2. Can you please tell me where you want to move it? Also, link to your site so that I can check it.

    Thread Starter micwie

    (@micwie)

    Hello,

    Thanks for reaching me out.

    1 – I have tried this code from the link you’ve provided.

    // display an 'Out of Stock' label on archive pages
    add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_stock', 10 );
    function woocommerce_template_loop_stock() {
        global $product;
        if ( ! $product->managing_stock() && ! $product->is_in_stock() )
            echo '<p class="stock out-of-stock">Coming soon!</p>';
    }

    Looks like the CCS styling is missing or something (check the link below) and actually it did not overwrote the badge, but created a new one. Here is the screenshot after implementing the code. You can also check it within this link

    https://imgur.com/a/I6WEAqS

    2 – Here is the site with the shop where I need to rewrite the content of this black “out of stock” badge.

    https://www.paulthevintage.com/staging/submenu-2-test/

    I would like to edit text (positioning would be also cool, but is not so important).

    Thank you in advance!

    micwie

    • This reply was modified 6 years, 3 months ago by micwie.

    Try to add the below code instead of the previous one and check it works or not.

    add_filter('ocean_woo_outofstock_text', 'out_of_stock_text');
    function out_of_stock_text($label) {
    
    	$label = esc_html__( 'SOLD OUT', 'oceanwp' );
    
    	return $label;
    }
    Thread Starter micwie

    (@micwie)

    Hey!

    This works like a charm! Do you think that some additional CSS could change the position and color of the box?

    Try to add the below code to the Customize > Custom CSS section

    .outofstock-badge {
        top: 0 !important;
        left: 0 !important;
        background-color: red !important;
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Out of stock badge (styling)’ is closed to new replies.