👋🏼Welcome to my WP-Host blog where I am excited to share my knowledge and expertise on WordPress hosting and website construction tutorials with you. Let’s connect and learn from each other! You can reach me at info@yrshare.com.
Add an inquiry button to the Woocommerce product page: Many people like to use wordpress+woocommerce to make product display websites. They don’t need the shopping function, they only need the inquiry function, allowing users to inquire through forms or emails. So today’s WordPress tutorial will share with you how to add an inquiry button link to the woocommerce product page.
Keep sharing wordpress tutorials. The recent wordpress website building project used the woocommerce plug-in, and the woocommerce plug-in itself is a mall, so its product page defaults to the purchase button. However, some products may not be suitable for direct online sales, or if you want to add an inquiry button under the purchase button, then you can refer to the following method.
add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 );
function my_extra_button_on_product_page() {
global $product;
echo '<a class="zsxxfx" href="https://www.aaa.com">Inquiry</a>';
}
You just need to replace the URL in the above code with the address you need to point to. For example, you can replace it with the chat link of the customer service tool, or replace it with your QQ account consultation link, or replace it with your third-party website. Store address, followed by [Inquiry] is the name of the button, you can modify it according to your needs. The code can be directly added to the functions.php file of the current wordpress website building theme, or use the Code Snippets plugin to add the code to the plugin.
Although the above method can add an inquiry button link, its original purchase button is still there. If none of your products are going to be sold online, you can also hide the add to shopping cart button, as shown in the picture above. The shopping cart button is hidden when the site is built. The implementation code is as follows:
Similarly, we can add the above code to the functions.php file of the current wordpress website building theme, or use the Code Snippets plugin to add it.
The method introduced today is relatively simple, and the style of the inquiry button is relatively primitive, which can only be used for improvisation. You can use CSS to modify it later.
【WordPress Hosting / 悦然wordpress建站】I am a WordPress hobby from China, and I like to communicate with friends from all over the world to learn WordPress website building and maintenance related knowledge.