This topic has 4 replies, 2 voices, and was last updated 5 days, 3 hours ago ago by Luca Rossi
Please check the private content area
Dear @Yasir Alam,
Thank you for reaching out to us.
We would like to inform you that there is a hook available that allows you to add custom code to display your badges and the Sale Booster estimated delivery date.
To implement this, please try adding the following custom code to the functions.php file located in your XStore Child Theme:
add_action('after_etheme_product_grid_list_product_element_title', 'after_etheme_product_grid_list_product_element_title', 999);
function after_etheme_product_grid_list_product_element_title(){
echo do_shortcode('[your-badges-shortcode]');
echo do_shortcode('[etheme_sales_booster_estimated_delivery]');
}
Should you have any questions or require further assistance, please do not hesitate to contact us.
Best regards,
The 8Theme Team
Please check private content area
Hi @Yasir Alam 8Theme,
What’s your product badges, so we can replace the shortcode for you?
We already see you have this code in your website:
function after_etheme_product_grid_list_product_element_title() {
// Run the shortcode and capture the output
$shortcode_output = do_shortcode('[etheme_sales_booster_estimated_delivery days_type="number"]');
// Debug: Output the shortcode result to check its format
// echo '<pre>' . print_r($shortcode_output, true) . '</pre>';
// Extract the numbers (days) from the shortcode output
preg_match_all('/\d+/', $shortcode_output, $matches);
// Ensure we are getting the correct numbers, looking for the last number (max_days)
$days = isset($matches[0]) ? $matches[0] : [];
if (count($days) < 2) {
// If we only have one number, use it for max_days
$max_days = isset($days[0]) ? intval($days[0]) : 0;
} else {
// Otherwise, use the second number as max_days
$max_days = intval($days[1]);
}
// Convert max days to hours
$max_hours = $max_days * 24;
// Output the custom HTML with the max hours
echo '
<div class="delivery">
<div class="express">
<img src="https://axhubs.com/wp-content/uploads/axhub-logo.svg" class="mr-1" alt="">
<div><span style="font-weight: bold;margin-right:2px;">Express Delivery:</span> ' . $max_hours . ' hours</div>
</div>
</div>';
}
Best regards,
The 8Theme Team
You must be logged in to reply to this topic.Log in/Sign up