mavv
Forum Replies Created
-
Hello,
thank you for your reply.
I understand your point about the
share.phpoverride in Flatsome. However, I am actively using Flatsome share buttons across the site, so removing or renaming that template is not really an option for me.In the Flatsome theme settings, Twitter sharing is disabled and X is enabled, and Flatsome share elements across the site appear to work correctly with X.
The issue I’m seeing occurs only with the YITH WooCommerce Wishlist share button, which currently outputs a Twitter icon and links to
twitter.com/share.This makes me wonder whether the wishlist sharing feature might still rely on a legacy Twitter implementation, which could explain the mismatch with the current sharing setup in Flatsome.
Could you please advise if there is a proper way to handle X sharing in the wishlist, or if there is a recommended workaround for this scenario?
Thank you for your help.
Hello,
Here it is – https://mavvori.com/en/
Following your answer, I decided to disable my custom snippet and check the plugin output directly:
I double-checked that I am using the latest version of the plugin. However, despite this, the wishlist share icon still points to Twitter and uses the Twitter icon. The HTML output is as follows:
<a target="_blank" rel="noopener nofollow" class="twitter icon button circle is-outline tooltip tooltipstered" href="https://twitter.com/share?url=https%3A%2F%2Fmavvori.com%2Fen%2Fwishlist%2Fview%2FBT4BGSQUUOT4%2F&text=" aria-label="Share on Twitter">
<i class="icon-twitter" aria-hidden="true"></i>
</a>At the moment, the only way to use the X icon and URL in the wishlist is by using my custom snippet.
I am using the latest WooCommerce version, the latest version of YITH WooCommerce Wishlist (4.11.0), and the Flatsome theme.
I have temporarily disabled my custom snippet to allow you to verify directly that the wishlist icon and link still point to Twitter instead of X.
Could you please advise if there is a proper fix for this issue or a recommended workaround?
Thank you in advance for your help.
Best regards,
P.S here is my custom snippet// Add inline script and CSS to wp_head for initial replacement
add_action('wp_head', function() {
// Only enqueue on frontend and wishlist pages
if (!is_admin() && !wp_doing_ajax() && (is_page('wishlist') || is_page('liste-de-souhaits'))) {
?>
<style>
/* Hide Twitter icon until replaced to prevent flickering */
i.icon-twitter {
opacity: 0;
transition: opacity 0.1s ease;
}
/* Show icon after replacement */
i.icon-x {
opacity: 1;
}
</style>
<script>
// Immediate replacement for Twitter icon to prevent flickering
if (window.location.pathname === '/en/wishlist/' || window.location.pathname === '/fr/liste-de-souhaits/') {
// Replace Twitter with X as soon as possible
const replaceTwitterWithX = () => {
document.querySelectorAll('a[href*="twitter.com"]').forEach(link => {
link.href = link.href.replace(/twitter\.com/i, 'x.com');
if (link.title) link.title = link.title.replace(/Twitter/i, 'X');
});
document.querySelectorAll('i.icon-twitter').forEach(icon => {
icon.classList.replace('icon-twitter', 'icon-x');
});
document.querySelectorAll('[data-tooltip*="Twitter"]').forEach(element => {
element.dataset.tooltip = element.dataset.tooltip.replace(/Twitter/i, 'X');
});
};
replaceTwitterWithX();
}
</script>
<?php
}
});
// Add MutationObserver in wp_footer for AJAX updates
add_action('wp_footer', function() {
// Only enqueue on frontend and wishlist pages
if (!is_admin() && !wp_doing_ajax() && (is_page('wishlist') || is_page('liste-de-souhaits'))) {
?>
<script>
// Run only on wishlist pages
document.addEventListener('DOMContentLoaded', () => {
// Check if the current page is the wishlist
const isWishlistPage = window.location.pathname === '/en/wishlist/' ||
window.location.pathname === '/fr/liste-de-souhaits/';
if (!isWishlistPage) return; // Exit if not on wishlist page
// Function to replace Twitter with X
const replaceTwitterWithX = () => {
document.querySelectorAll('a[href*="twitter.com"]').forEach(link => {
link.href = link.href.replace(/twitter\.com/i, 'x.com');
if (link.title) link.title = link.title.replace(/Twitter/i, 'X');
});
document.querySelectorAll('i.icon-twitter').forEach(icon => {
icon.classList.replace('icon-twitter', 'icon-x');
});
document.querySelectorAll('[data-tooltip*="Twitter"]').forEach(element => {
element.dataset.tooltip = element.dataset.tooltip.replace(/Twitter/i, 'X');
});
};
// Initial replacement (backup for late-loaded elements)
replaceTwitterWithX();
// Observe DOM changes for dynamically added elements
const observer = new MutationObserver((mutations) => {
mutations.forEach(() => replaceTwitterWithX());
});
// Start observing the wishlist container
const wishlistContainer = document.querySelector('.yith-wcwl-share') || document.body;
if (wishlistContainer) {
observer.observe(wishlistContainer, { childList: true, subtree: true });
}
});
</script>
<?php
}
});- This reply was modified 5 months, 3 weeks ago by mavv.
Thank you both for your replies and suggestions. I’ll try all options and see which one works best for me.
I’m also looking forward to the new version of the plugin where it will be possible to disable applying the security policy to the admin area.Wishing you a great day!
Thank you, Anthony!
After your advice, I started digging deeper into the FTP files, trying to understand how Kadence was triggered. After 7–8 hours of brainstorming with ChatGPT, DeepSeek, and analyzing FTP files, I finally found a working solution.
The issue was that the email confirmation was not part of the standard WooCommerce registration process. As a result, WC mailing and Kadence weren’t initialized at the moment of the meta key change. The fix was simply to reinitialize them at the right moment.
Really appreciate your guidance—it helped me approach the problem from the right angle!
add_action('updated_user_meta', 'initialize_kadence_email_system', 10, 4);
function initialize_kadence_email_system($meta_id, $user_id, $meta_key, $meta_value) {
if ($meta_key === 'bf_activation' && $meta_value == 1) {
if (class_exists('Kadence_Woomail_Designer')) {
$kadence_woomail = Kadence_Woomail_Designer::get_instance();
$kadence_woomail->on_init();
}
send_wc_new_user_email_notification($user_id);
}
}
function send_wc_new_user_email_notification($user_id) {
if (class_exists('WC_Email_Customer_New_Account')) {
$email = new WC_Email_Customer_New_Account();
$email->email_type = 'html';
$email->trigger($user_id, null, true);
error_log('WooCommerce email triggered for user ID: ' . $user_id);
} else {
error_log('WC_Email_Customer_New_Account class not found.');
}
}Hello @aapc
Thank you for your reply.I use Bitform’s plugin registration form with the WP Auth feature for customer registration. The problem is that if I don’t enable the email confirmation option (and the WC email is sent at the moment of registration), Kadence plugin correctly overrides the WooCommerce new customer email. However, when I enable email confirmation (which is mandatory in the EU), the registration process works differently—users are created as soon as the form is validated, but they can only access the site after confirming their email.
To work around this, I tried using a meta change to trigger the standard WooCommerce email notification, attempting to replicate WooCommerce’s original procedure as closely as possible.
I’ve tested multiple approaches, including
do_action,wc_mail, and scripts like this one:add_action('updated_user_meta', 'send_wc_new_user_email_notification', 10, 4);function send_wc_new_user_email_notification($meta_id, $user_id, $meta_key, $meta_value) {
if ($meta_key === 'bf_activation' && $meta_value == 1) {
$user = get_userdata($user_id); // Get user data
do_action('woocommerce_created_customer', $user_id, array(), $user); // Trigger WooCommerce's default email flow
}
}
However, this method seems to be missing something that the Kadence plugin relies on as a trigger to override the email. When triggered this way, the email lacks styling, as well as the header and footer.
Unfortunately, Bitform’s developers haven’t been very cooperative on this issue. However, even if they were, there’s likely nothing they could do, as the problem lies in how the Kadence plugin detects and overrides the WooCommerce email. Since I’m trying to use WooCommerce’s standard email procedure, Kadence should theoretically apply its usual overrides, but for some reason, it doesn’t in this case.Hi Anthony,
Thanks so much for your helpful response! I’ll definitely give it a try with the body classes you mentioned.
I have one more question.
How can I properly trigger the WooCommerce new user email so that Kadence automatically applies its template to it? Or, what hooks does Kadence use to override the default WooCommerce new user email?
Thank you in advance!- This reply was modified 1 year, 3 months ago by mavv.
UPD
So i tried this code using YayMail – WooCommerce Email Customizer, the triggered email has the proper template with a header and footer.add_action('updated_user_meta', 'send_wc_new_user_email_notification', 10, 4);function send_wc_new_user_email_notification($meta_id, $user_id, $meta_key, $meta_value) {
if ($meta_key === 'bf_activation' && $meta_value == 1) {
$user = get_userdata($user_id); // Get user data
do_action('woocommerce_created_customer', $user_id, array(), $user); // Trigger WooCommerce's default email flow
}
}
The issue seems is that the Kadence plugin can’t properly apply the template to a custom triggered default WC new user email using such codes.It’s a pity because I prefer the Kadence Template Builder MUCH more!
- This reply was modified 1 year, 4 months ago by mavv.
Thank you very much for your reply. I will consider it as an option, but for now, I am trying to trigger the default WooCommerce new customer email as close as possible to the original procedure so that the Kadence template is applied automatically.
Could you please tell me what conditions the Kadence plugin requires for an email to be considered the ‘default WooCommerce new user email’?
@karlalevelup
Following your advice, I tried this code:add_action(‘updated_user_meta’, ‘send_wc_new_user_email_notification’, 10, 4);
function send_wc_new_user_email_notification($meta_id, $user_id, $meta_key, $meta_value) {
if ($meta_key === ‘bf_activation’ && $meta_value == 1) {
$user = get_userdata($user_id); // Get user data
do_action(‘woocommerce_created_customer’, $user_id, array(), $user); // Trigger WooCommerce’s default email flow
}
}
However, I am still facing the same issue. The email is triggered, but the styles are not applied correctly.When I manually reject and reapprove a user as an admin after the user’s registration, the email is sent with the correct template. But when the email is sent using the trigger above or any other trigger I have tried earlier (triggers that are supposed to send the default WooCommerce new user welcome emai) the template is not applied every time
The issue does not appear to be related to Bitform’s registration form procedure, as the metadata they use seems to work correctly in triggering WooCommerce emails without any problems. Instead, it seems that the Kadence plugin is unable to apply the template to the default WooCommerce new user email when it is triggered using
do_actionor other triggers outside of WooCommerce’s default registration process.Do you have any advice on how to fix this issue?
Thank you in advance!@shahzeenfarooq
Thank you for your suggestion, however despite the plugins I have implemented, my initial question remains: How can I correctly trigger WooCommerce’s “New User Welcome Email” outside of the standard WooCommerce registration process? This functionality is still part of WooCommerce’s default core features.Hello @ravindra107
Thank you for proposed solution.
The code you suggested is one of the first solutions I tried during my initial experiments. Unfortunately, when used after email confirmation, this code does not trigger the WooCommerce welcome email, even when WooCommerce is initialized first.
- This reply was modified 1 year, 4 months ago by mavv.
Thank you for your reply I will try to follow your advise and will post later if it will work or not.
Have a nice day/evening!