Support » Plugin: Quotes for WooCommerce » How to add sku in the email tables sent to the site manager?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Pinal Shah

    (@pinalshah)

    Hi @runakuyay,

    I apologize for the delay in response. You can fetch the sku of a product by calling the function get_sku() on the product object. So in a scenario where you have the product id available in $product_id variable the below patch would work fine.

    $_product = wc_get_product( $product_id );
    $sku = $_product->get_sku();

    I hope this helps.

    Thanks,
    Pinal

    Plugin Author Pinal Shah

    (@pinalshah)

    Hi @runakuyay,

    Just an update. The existing email template loops through the order items which are fetched using $order_obj->get_items().

    So inside the foreach for the order items, you can fetch the product id as below:

    foreach ( $order_obj->get_items() as $items ) {
    $product_id = $items->get_product_id();
    }

    Thanks,
    Pinal

    Hi @pinalshah , excuse my ignorance but I am just learning. Where should I go to put that patch?

    Plugin Author Pinal Shah

    (@pinalshah)

    Hi @nicodales,

    The above is with reference to editing an existing email template in the plugin. The best approach here is to copy the email template using WooCommerce->Settings->Emails->Manage Email (for the template you wish to edit)->Copy template to theme button.

    Once the email template has been copied to your active theme, you can edit it as needed.

    So as stated above, you can edit the foreach for the get_items() and add data as needed.

    I hope this helps.

    Thanks,
    Pinal

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.