WPSlash

Replace Product Title with SKU on Automatic Printing Software

Friday October 30, 2020

Copy and paste the below code to your functions.php on your child theme.

add_filter('woofood_rest_line_item_name', 'woofood_hook_replace_title_with_sku', 10, 2);

function woofood_hook_replace_title_with_sku($product_name, $product_id)
{
    global $woocommerce;
    return wc_get_product($product_id)->get_sku();

}

In case you want to use also the product name and SKU you can use the following code

add_filter('woofood_rest_line_item_name', 'woofood_hook_replace_title_with_sku', 10, 2);

function woofood_hook_replace_title_with_sku($product_name, $product_id)
{
    global $woocommerce;
    return $product_name." ".wc_get_product($product_id)->get_sku();

}

Leave a Comment

Your email address will not be published. Required fields are marked *

×

🔥 ONE DAY ONLY OFFER 🔥

Upgrade FoodMaster Today

Normally your license is limited to 1 Website.

Today only, get a LIFETIME Unlimited Websites License for just:
$499

✔ Unlimited Client Websites
✔ Unlimited Personal Projects
✔ Future Updates Included
✔ Save Hundreds on Additional Licenses

Offer Ends In: