This topic has 6 replies, 2 voices, and was last updated 1 years, 10 months ago ago by Rose Tyler
Hello again
This is continuation to topic started here: https://www.8theme.com/topic/woocommerce-waitlist-incompatibility-for-single-products/
I noticed only now that your solution works great but only for single product which is out of stock. For single product in backorder it placing waitlist widget in wrong place.
Here what i see now: https://gyazo.com/edaf4e70ffc49df73c7d0b0cc90e884b
as you see waitlist is after add to cart buttons but should be above as it is for now in case of variable products in backorder: https://gyazo.com/029f5fec1f5404079e8c718421b34c7a
I did try to modify your code by adding one more IF
add_action('wp', function() {
// add compatibility with WooCommerce Waitlist plugin and XStore Single product builder
if ( class_exists('Pie_WCWL_Frontend_Simple') ) {
if ( Pie_WCWL_Frontend_Simple::$product_id ) {
global $product;
if ( is_product() ) {
if ( $product->is_in_stock() ) {
add_action('woocommerce_before_add_to_cart_button', array('Pie_WCWL_Frontend_Simple', 'output_waitlist_elements'), 15);
}
else {
add_action('etheme_woocommerce_template_single_add_to_cart', array('Pie_WCWL_Frontend_Simple', 'output_waitlist_elements'), 30);
}
}
}
}
}, 20);
but Im not sure this is the best solution as even if I got the right place on single product page I also added this widget to other paces … e.g. in sticky bar: https://gyazo.com/886d28d9357a25ece349d678ad666580
As by my code I could mess up too much I kindly ask you for support please 🙂
Hello, Krzysztof,
Please check the results now. We have provided screenshots for your reference at the following links: https://prnt.sc/imq1P3zGYPrP and https://prnt.sc/OXpE7Beg-Qw5
Additionally, we have also provided an improved version of the code, which can be found at the following link: https://prnt.sc/v7sHazYZ1KtI
Code:
add_action('wp', function() {
// add compatibility with WooCommerce Waitlist plugin and XStore Single product builder
if ( class_exists('Pie_WCWL_Frontend_Simple') ) {
if ( Pie_WCWL_Frontend_Simple::$product_id ) {
global $product;
if ( !$product->is_in_stock() ) {
add_action('etheme_woocommerce_template_single_add_to_cart', array('Pie_WCWL_Frontend_Simple', 'output_waitlist_elements'), 20);
}
else {
add_action('woocommerce_before_add_to_cart_form', array('Pie_WCWL_Frontend_Simple', 'output_waitlist_elements'), 10);
add_action('etheme_sticky_add_to_cart_before', function() {
remove_action('woocommerce_before_add_to_cart_form', array('Pie_WCWL_Frontend_Simple', 'output_waitlist_elements'), 10);
});
add_action('etheme_sticky_add_to_cart_after', function() {
add_action('woocommerce_before_add_to_cart_form', array('Pie_WCWL_Frontend_Simple', 'output_waitlist_elements'), 10);
});
}
}
}
}, 20);
Kind Regards,
8theme team
Hello, Rose
We are almost there 🙂
Waitlist widget is in the right place now =, thank you for corrected code, but again it is missing on simple product which is out-of-stock … so case where we started 🙂
Hello, Krzysztof,
We changed the code in your xstore-child/functions.php ( https://prnt.sc/2gpoaYbtPd-p ), and also it was changed in the previous answer.
For now, those products have waitlist form, please, check !
Kind Regards,
8theme team
Looks good now … thank you very very much.
I will make fer more deep tests prior to production strat and will let you know if I will find anything else (but I do not expect any more issues) 🙂
You’re welcome!
Would you mind to rate our product – https://themeforest.net/downloads
We’d appreciate if you could take a moment to give us 5-stars on ThemeForest!
Kind Regards,
8theme team
You must be logged in to reply to this topic.Log in/Sign up