Hi @thetankgirl ,
We’re happy to offer you a custom solution with the code provided below. We assume you’ve already set up the child theme for 8theme XStore. To display the badge, simply add the following code to your child theme’s functions.php
file:
function get_product_badge_html() {
// Ensure this is correct path of the plugin file
$plugin_dir = WP_PLUGIN_DIR . '/woo-stickers-by-webline/public/class-woo-stickers-by-webline-public.php';
// Check if the plugin's class file exists before requiring it
if (file_exists($plugin_dir)) {
// Include the plugin's public class file
require_once $plugin_dir;
// Instantiate the plugin's main class and its public class
$woo_stickers = new Woo_Stickers_By_Webline();
$plugin_public = new Woo_Stickers_By_Webline_Public($woo_stickers->get_plugin_name(), $woo_stickers->get_version());
// Get the current product ID
$product_id = get_the_ID();
// Check if the method 'show_product_cust_badge' exists in the public class
if (method_exists($plugin_public, 'show_product_cust_badge')) {
// Start output buffering
ob_start();
// Call the method to display the product badge
$plugin_public->show_product_cust_badge($product_id);
// Get the buffered output and clean the buffer
$output = ob_get_clean();
// Output the badge HTML
echo $output;
} else {
// Output a message if the method does not exist
echo 'Method show_product_cust_badge does not exist.';
}
} else {
// Output a message if the plugin file is not found
echo 'Plugin file not found.';
}
}
// Hook the function to 'etheme_before_single_product_image' action
add_action('etheme_before_single_product_image', 'get_product_badge_html');
Please let us know if you still have any query. Kindly message us here if it works.