N
N
nikita29112019-03-14 11:02:12
WordPress
nikita2911, 2019-03-14 11:02:12

How to open different contact forms when clicking on the "price on request" button for WooCommerce products depending on its category?

Good day! Found the code that opens the Contact Form 7 when clicking on the "price on request" link

function my_price_replace($price, $_product) {
if ($_product->get_price() == 0) return __('
<span><a class="fancybox-inline btn" href="#contact_form_pop">Цена по запросу</a></span>
<div class="fancybox-hidden" style="display: none;">
<div id="contact_form_pop">'.do_shortcode('[contact-form-7 "Форма обратной связи"]').'</div></div>
');
return $price;
}
add_filter( 'woocommerce_empty_price_html', 'my_price_replace', 1, 2 );

This code needs to be slightly improved so that for products from different categories, when you click on the “price on request” link, its own contact form pops up depending on the product category.
For example, if the product category is "Clothes", then open one contact form, if "Shoes", then another

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question