Product Enquiry for WooCommerce Shortcode

Below, you’ll find a detailed guide on how to add the Product Enquiry for WooCommerce Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Product Enquiry for WooCommerce Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Product Enquiry for WooCommerce Plugin and the shortcodes it provides:

✩✩✩✩✩ () Active Installs: + Tested with: PHP Version:
Included Shortcodes:

Product Enquiry for WooCommerce [gmwqp_enquiry_single_product] Shortcode

The gm-woocommerce-quote-popup plugin shortcode, ‘gmwqp_enquiry_single_product’, enables users to make product inquiries directly. The code checks if a product ID is set, fetches the product, and verifies if it’s excluded from inquiries. If not, it displays an ‘Inquiry!’ button.

Shortcode: [gmwqp_enquiry_single_product]


Here is a list of all possible gmwqp_enquiry_single_product shortcode parameters and attributes:

  • id – Specifies the unique identifier of the product

Examples and Usage

Basic example – The shortcode displays an enquiry button for a single product in WooCommerce. The product is identified by its ID, which is passed as an attribute to the shortcode.

[gmwqp_enquiry_single_product id=25 /]

Advanced examples

The shortcode can be used without passing any ID. In this case, it will automatically fetch the ID of the current product in the loop and display the enquiry button for it.

[gmwqp_enquiry_single_product /]

If you want to use the shortcode inside a PHP file, you can use the do_shortcode function. This is especially useful when you want to add the enquiry button in a custom location in your theme files.

Remember, the ID attribute should be replaced with the actual ID of the product for which you want to display the enquiry button.

PHP Function Code

In case you have difficulties debugging what causing issues with [gmwqp_enquiry_single_product] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('gmwqp_enquiry_single_product', array( $this, 'gmwqp_enquiry_single_product_shortcode' ));

Shortcode PHP function:

function gmwqp_enquiry_single_product_shortcode($atts){
		global $post;
		if (isset($atts['id']) && $atts['id']!='') {
			$product_id = $atts['id'];
			$product = wc_get_product( $product_id );
			$product_id = $post->ID;
			$product = wc_get_product( $product_id );
			if (get_option('gmwqp_button_label')!='') {
					$gmwqp_button_label = get_option('gmwqp_button_label');
				$gmwqp_button_label = __('Inquiry!', 'gmwqp' );
			<div class="gmwqp_inquirybtn_loop">
				<a href="#" class="button gmwqp_inq " title="<?php echo $product->get_name(); ?>" attr_id="<?php echo $product->get_id();?>"><?php echo $gmwqp_button_label;?></a>
		$output = ob_get_contents();
		return $output;

Code file location:



Now that you’ve learned how to embed the Product Enquiry for WooCommerce Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.


Leave a Reply

Your email address will not be published. Required fields are marked *