• Resolved Tarjeet Singh

    (@tarjeet98)


    Hello there! As per the requirement I wanted to show the related products in carousel style and I am able to achieve that because of your plugin. Thank you for that.

    However, I also wanted to display SKU code, there is no such option in your plugin to display SKU code.

    I tried to add function code and it doesn’t work with your plugin I guess.
    Can you guys help me to display SKU code in related products section. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WPBean

    (@wpbean)

    You can add this code to your theme or child theme’s functions.php file. It will show the SKU in the related product slider.

    add_action( 'wpb_wrps_after_price', function(){
        if( function_exists( 'wc_get_product' ) ){
            $product = wc_get_product( get_the_id() );
            echo sprintf( '<span>%s</span>', esc_html( $product->get_sku() ) );
        }
    } );
    Thread Starter Tarjeet Singh

    (@tarjeet98)

    Thank you for your reply, the code works great, but I wanted to show before title.
    I tried replacing “wpb_wrps_after_price” with “wpb_wrps_before_price”.
    But it won’t work. Can you please help me to show SKU code before price. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show SKU Code on Related Products’ is closed to new replies.