Assunto: [your-name] tem interesse no produto [_post_title]
Cabeçalhos adicionais: Reply-To: [your-email]
Corpo da Mensagem:
De: [your-name] <[your-email]>
Telefone: [telefone]
Empresa: [tempresa]
url: [_url]
Máquina: [_post_title]
data: [_date]
hora: [_time]
Last active
January 17, 2022 14:02
-
-
Save tiagocordeiro/b1df1a8eb0bc10cf7e5cc57ee5728d2e to your computer and use it in GitHub Desktop.
Shows contact form when product out of stock [WooCommerce, ContactForm7]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Quer encomendar esse produto?<br>Preencha o formulário abaixo e clique em "QUERO ENCOMENDAR", nossa equipe entrará em contato para tratar dos detalhes.</p> | |
<div class="row"> | |
<div class="col-md-6" style='margin-bottom:20px;'><label>Seu nome</label>[text* your-name]</div> | |
<div class="col-md-6" style='margin-bottom:20px;'><label>Seu email</label>[email* your-email]</div> | |
</div> | |
<div class="row"> | |
<div class="col-md-6" style='margin-bottom:20px;'><label>Telefone</label>[tel telefone class:phone]</div> | |
<div class="col-md-6" style='margin-bottom:20px;'><label>Empresa</label>[text empresa]</div> | |
</div> | |
<p>[submit class:btn-color-black "QUERO ENCOMENDAR"]</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Esta função deve ser adicionada no functions.php do tema filho. | |
* Para funcionar deve ter WooCommerce e ContactForm7 instalados. | |
* Não esqueça de alterar o shortcode do formulário na função. | |
*/ | |
//Formulário de interesse em produto fora do estoque | |
add_action('woocommerce_single_product_summary', 'add_contact_form', 30,2); | |
function add_contact_form() { | |
global $product; | |
if( ! $product->is_in_stock( ) && ! $product->is_type('variable') ) | |
echo do_shortcode('[contact-form-7 id="8799" title="Encomenda form"]'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment