Home Forums WoodMart support forum SKU Settings Display Parrent SKU Instead Of Variation SKU

SKU Settings Display Parrent SKU Instead Of Variation SKU

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #564094

    Mike
    Participant

    Hi, i just realize that the settings for the sku products on woodmart theme display the parrent sku instead of variation sku. I made a short video for you so you can understood what i mean. Check the video on private content

    #564231

    Mike
    Participant

    Bump

    #564290

    Hung Pham
    Keymaster

    Hi Mike,

    Thanks for reaching to us.

    Please add below code to functions.php file in Child theme

    if ( ! function_exists( 'woodmart_output_sku_in_thank_you_page' ) ) {
    	/**
    	 * Show SKU on thank you page.
    	 *
    	 * @param int    $item_id Item ID.
    	 * @param object $item Product item.
    	 * @param object $order Order.
    	 */
    	function woodmart_output_sku_in_thank_you_page( $item_id, $item, $order ) {
    		if ( ! woodmart_get_opt( 'show_sku_in_thank_you_page' ) ) {
    			return;
    		}
    
    		$product_id = $item->get_variation_id() ? $item->get_variation_id() : $item->get_product_id();
    		$product    = wc_get_product( $product_id );
    		$sku        = $product->get_sku();
    
    		if ( ! $sku ) {
    			return;
    		}
    
    		?>
    		<div class="wd-product-sku">
    			<span class="wd-label">
    				<?php echo esc_html__( 'SKU:', 'woodmart' ); ?>
    			</span>
    			<span>
    				<?php echo esc_html( $sku ); ?>
    			</span>
    		</div>
    		<?php
    	}
    
    	add_action( 'woocommerce_order_item_meta_start', 'woodmart_output_sku_in_thank_you_page', 10, 3 );
    }

    Regards,

    #564401

    Mike
    Participant

    Will be included on future updates or needed to keep it forever?

    #564570

    Hung Pham
    Keymaster

    Hi Mike,

    Our developer will takes a look and include it in the next version.

    Regards,

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