Add SKU to Cart and Order (email) - by Alan

This topic has 10 replies, 3 voices, and was last updated 7 years, 10 months ago ago by 8theme

  • Avatar: coureyusa
    Alan
    Participant
    January 6, 2017 at 17:41

    Hi I would like to add the product SKU’s to the Cart, Checkout, and to the completed Order emails.

    I found an article on how to add the SKU’s to the Cart, but it doesn’t show the same directory scheme as what I have.
    I am using Xstore Child theme and wondering where to add the code that the article suggests.
    The article is: http://www.jdhodges.com/blog/show-sku-in-cart-checkout-woocommerce/

    Can you please tell me where to adjust the code to achieve this?

    Thank you!!!!

    WordPress 4.7
    WooCommerce 2.6.11
    Xstore 3.3
    XStore Child Theme 1.0
    hosted @ 1and1.com

    9 Answers
    Avatar: 8theme
    8theme
    Support staff
    January 9, 2017 at 09:04

    Hello,

    Unfortunately, our theme doesn’t have it by default and it needs additional code customization that is out of theme support scope.

    Regards

    Avatar: coureyusa
    Alan
    Participant
    January 9, 2017 at 21:42

    I would think that every E-Commerce store would need to have a SKU displayed, as that is how most stores operate, by sku’s.

    Can you give my some direction, as what I am trying to add to the cart.php in the child directory is not displaying the sku.
    Thanks

    Avatar: coureyusa
    Alan
    Participant
    January 9, 2017 at 21:44

    I would think adding a SKU in the cart/emails would be a very minor change (one that is needed on an e-commerce/business website.

    Avatar: georcarson
    George
    Participant
    January 10, 2017 at 01:16

    I agree with the need for an sku in the cart and checkout function. It is actually a vital piece of information!!!!! When using automated software for efficient processing of large numbers of online generated orders, you upload information from your ecommerce website (I use T-HUB – see http://www.atandra.com to do this) and/or Amazon, Ebay etc, a vital piece of information is the sku to match up with your Quickbooks (or other accounting software) information so in my case T-HUB can export the sku to Quickbooks to load invoicing etc, then the sku matches up to print a shipping label generated based on that sku product weight and dimmensions. Woo Commerce does integrate with most all automated software packages, but again, needs the sku. Please make this a feature on your very next release.

    Avatar: 8theme
    8theme
    Support staff
    January 10, 2017 at 11:41

    Hello,

    Yes, it is a very good suggestion. But if it is so important maybe it should be integrated to WooCommerce rather then into themes? All shopping functionality comes with this plugin and our theme provide only a stylization for them. To add this function to our theme we have to override some WooCommerce templates and functions that is not best practice for WordPress themes.

    Thank you for understanding.

    Kind Regards

    Avatar: coureyusa
    Alan
    Participant
    January 10, 2017 at 19:53

    Uh Oh, I was wrong. WooCommerce DOES display the SKU in the email that goes to the site admin.
    It places the SKU in parentheses (). Example:

    Product QTY Price
    60″ Shower Door SD200B (#25130995) 1 $50.00

    But it does NOT display the SKU in the email that the customer receives after placing the order.

    So I just need to figure out how to add the SKU to the cart.php

    Any advice would be appreciated.
    Thanks

    Avatar: 8theme
    8theme
    Support staff
    January 11, 2017 at 14:39

    Hi,

    Try to add this code snippet to the functions.php file in the child theme

    add_filter( 'woocommerce_in_cart_product_title', 'add_sku_in_cart', 20, 3);
    
    function add_sku_in_cart( $title, $values, $cart_item_key ) {
      $sku = $values['data']->get_sku();
      return $sku ? $title . sprintf(" (SKU: %s)", $sku) : $title;
    }

    Regards

    Avatar: georcarson
    George
    Participant
    January 28, 2017 at 00:51

    I tried to use the code snippet to the functions.php file in the Child Theme that you provided to add the sku to the car and it does not work. Anything else you can add?

    Avatar: 8theme
    8theme
    Support staff
    January 30, 2017 at 08:35

    Hello,

    Sorry, but we don’t have other solution for this. This question is related to additional code customization and it is out of our free theme support scope. If you want us to implement this functionality for you we can do this as a paid service.

    Regards

  • Viewing 10 results - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.