Home Forums WoodMart support forum Move product SKU under title

Move product SKU under title

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #331915

    Global Touch
    Participant

    Hello,

    how can I change position of product SKU under product title?

    Thanks in advance.

    #331996

    Luke Nielsen
    Keymaster

    Hello,

    Unfortunately, we can’t replace the position of the “SKU” but we can add a new “SKU” under the title and hide the old (by default).

    https://monosnap.com/file/o1ntr4quFLZEu1FZRdigiAeuxIBvJF

    In order to add the “SKU” under the title, please try to add this code to the functions.php file in your child theme.

     if ( ! function_exists( 'wd_single_replace_sku' ) ) {
    
        function wd_single_replace_sku() {
            global $product;
    
            if ( wc_product_sku_enabled() && ( $product->get_sku() || $product->is_type( 'variable' ) ) ) : ?>
                <div class="product_meta product_meta_under_title">
    		        <span class="sku_wrapper_under_title"><?php esc_html_e( 'SKU:', 'woocommerce' ); ?> <span class="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : esc_html__( 'N/A', 'woocommerce' ); ?></span></span>
                </div>
    	<?php endif;
        }
    
        add_action( 'woocommerce_single_product_summary', 'wd_single_replace_sku', 5 );
     }

    To hide the “SKU” by default, please add this custom CSS code in Theme Settings -> Custom CSS -> enter the code below in the “Global Custom CSS” field.

    .single-product .product_meta .sku_wrapper {
        display: none !important;
    }
    
    .product_meta.product_meta_under_title {
        padding-top: 0;
        border-top: 0;
    }

    Kind Regards

    #357485

    razwan73
    Participant

    Hi,

    What will be the revised code if I want the SKU before Title (instead of after title)? So, the Title will be under Sku.

    Thanks

    #357561

    Artem Temos
    Keymaster

    Hello,

    Try to edit your code and change this value 5 to 1 https://prnt.sc/n_B14nVyAr_h

    Kind Regards

Viewing 4 posts - 1 through 4 (of 4 total)