Untitled
unknown
plain_text
2 months ago
654 B
2
Indexable
// Display the product SKU in the cart and checkout pages function aovup_display_product_sku_in_cart_and_checkout($item_data, $cart_item) { // Get the product ID from the cart item $product_id = $cart_item['product_id']; // Get the SKU of the product $product = wc_get_product($product_id); $product_sku = $product->get_sku(); // Add the SKU to the cart item data if (!empty($product_sku)) { $item_data[] = array( 'key' => 'SKU', 'value' => $product_sku, ); } return $item_data; } add_filter('flatsome_product_title', 'aovup_display_product_sku_in_cart_and_checkout', 10, 2);
Editor is loading...
Leave a Comment