I needed to report the sku code in an e-commerce wishlist. I have YITH Wishlist premium installed on the site and use bricks builder.
I used the following code:
<?php
function add_sku_after_product_name( $item, $wishlist ) {
$product = $item->get_product();
$SKU = $product->get_sku();
echo wp_kses_post('<p> [SKU: '.$SKU.']</p>');
}
// Mi aggancio all'action hook 'yith_wcwl_table_after_product_name'
add_action( 'yith_wcwl_table_after_product_name', 'add_sku_after_product_name', 10, 2 );
On desktop it works fine, but on mobile it gives me a critical error. What could it be?
(when I disable the snippet the wishlist goes back to working perfectly)
I tried changing where the snippet was being loaded, but to no avail.