This topic has 2 replies, 2 voices, and was last updated 2 years, 6 months ago ago by Olga Barlow
Hi there,
I have an issue with my single product page.
It is not showing the name of the product. I stead, shows.
I tried disableing all the plugins to see if it was a proble with another plugin compatibilty, but with woocommerce and Xstore plugin activated, it has this issue.
Also, the NEW IN badge is showing on the side, in stead of being over the photo.
Iam using this codes on my function.php to display the NEW IN badge. On the shop page, it show ok, but single product page is being missplaced.
// New badge for recent products ON SHOP
add_action( 'woocommerce_before_shop_loop_item_title', 'new_badge', 3 ); function new_badge() { global $product; $newness_days = 10; // Number of days the badge is shown
$created = strtotime( $product->get_date_created() ); if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) < $created ) { echo '<span class="new-badge onsale">' . esc_html__( 'NEW', 'woocommerce' ) . '</span>'; } }
// New badge for recent products on single product page
add_action( 'woocommerce_single_product_summary', 'new_badge_single_product', 7 );
function new_badge_single_product() {
global $product;
$newness_days = 30; // Number of days the badge is shown
$created = strtotime( $product->get_date_created() );
if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) < $created ) {
echo '<span class="itsnew">' . esc_html__( 'NEW', 'woocommerce' ) . '</span>';
}
}
Do you know what can be causing this?
Best regards,
Hello,
1) Go to Theme Options > WooCommerce > Single product > Move Product Name In Breadcrumbs > Off.
2) Single product displays the badge depending on the hook that you used. You used the woocommerce_single_product_summary, check this guide about hooks positions https://www.businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/
So, everything is according to your code. If you want to place that over the image use woocommerce_before_single_product_summary
hook. Check label now, please.
Regards
The issue related to '‘Product name not showing on single product page’' has been successfully resolved, and the topic is now closed for further responses