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 🙂