Contact form when product out of stock
-
Hi,
I’ve scoured the forum and online but can’t seem to find a solution to my problem. I’ve tried tonnes of PHP to try and get a contact form to appear on the product page when it’s out stock.
I’ve managed to do it but it only works if the “Out of Stock” message is below the contact form. The form just doesn’t show if the message is above.
I’m using the following code:
`add_action(‘woocommerce_after_shop_loop_item’, ‘themelocation_change_outofstock_to_contact_us’, 1);
// for single page
add_filter(‘woocommerce_get_availability’, ‘wcs_custom_get_availability’, 1, 2);
function wcs_custom_get_availability($availability, $_product) {
// Change Out of Stock Text
if (!$_product->is_in_stock()) {
echo do_shortcode(‘[fluentform id=”1″]’);
$availability[‘availability’] = __(‘Out of stock – Enter your details below to be Notified when back in stock’, ‘woocommerce’);
return $availability;
}
}`I know the “Out of stock message comes up with the “return availability” bit but if I enter this above the “echo do shortcode” it won’t work.
I’m hoping someone can help?
The page I need help with: [log in to see the link]
- The topic ‘Contact form when product out of stock’ is closed to new replies.