Version: 1.0
Author: Martin Ndegwa Moche
Description: This is a WordPress plugin that allows users to generate product quotes within a WooCommerce store using a simple shortcode [woocommerce-quote-generator]. It integrates React and PHP to provide a seamless quoting experience.
WooCommerce Quote Generator is a WordPress plugin that enables customers to request quotes for products in a WooCommerce-powered store. It seamlessly integrates React and PHP, offering an interactive quoting experience via the [woocommerce-quote-generator]
shortcode.
- Shortcode-Based Integration: Easily add a quote generator anywhere using
[woocommerce-quote-generator]
. - React-Powered Interface: A modern and interactive quoting system built with React.
- WooCommerce Compatibility: Fully integrates with WooCommerce, ensuring smooth product selection and quote requests.
- Custom Thank You Page Handling: Uses custom rewrite rules to manage quote submission redirects.
- AJAX & Nonce Security: Implements AJAX-based operations with nonce verification for security.
woocommerce-quote-generator/
│
├── build/
│ ├── index.js # Compiled React components
│ ├── index.asset.php # Asset dependencies
│
├── includes/
│ ├── class-quote-generator-api.php # Handles admin interface
│ ├── class-quote-generator.php # Handles AJAX requests
│
├── src/
│ ├── components/
│ │ ├── CartSummary.js # React component for the admin form
│ │ ├── CheckoutForm.js # React component for video lists
│ ├── App.js # Main React app entry
│ ├── index.js # React app renderer
│
├── woocommerce-quote-generator.php # Main plugin file
├── package.json # Node.js dependencies
└── README.md
- Download the plugin and upload it to your WordPress site.
- Activate the plugin from the WordPress admin dashboard.
- Ensure WooCommerce is installed and activated.
- Use the shortcode
[woocommerce-quote-generator]
in any post or page to display the quote generator.
- Navigate to a page where the shortcode
[woocommerce-quote-generator]
is used. - Select WooCommerce products to include in the quote.
- Submit the quote request through the interactive form.
- Customers will receive a confirmation, and site admins can manage quotes accordingly.
- Primary File:
woocommerce-quote-generator.php
- Shortcode Functionality: Registered via
add_shortcode('woocommerce_quote_generator', 'wqg_display_quote_generator')
. - React Integration: The frontend is powered by a React app (
build/index.js
), enqueued viawp_enqueue_script
. - Custom Rewrite Rules: Implements a custom "Thank You" page rewrite rule (
thankyou/{order_id}
). - API Communication: Uses
class-quote-generator-api.php
for backend processing.
The plugin relies on:
@wordpress/scripts
for build tools.bootstrap
andreact-bootstrap
for UI components.react-phone-input-2
for phone input handling.
To build the React app:
npm install
npm run build
npm run start
This plugin is licensed under GPL2. Feel free to modify and distribute it.
Developed by Martin Ndegwa Moche.