=== CartLink Generator for WooCommerce — Direct Checkout & Share Cart Links === Contributors: elvinhaci Tags: direct checkout link, share cart, buy now, whatsapp checkout, prefilled cart Requires at least: 5.5 Tested up to: 7.0.1 Requires PHP: 7.0 WC requires at least: 8.0 WC tested up to: 10.9.4 Requires Plugins: woocommerce Stable tag: 1.1.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Generate shareable direct-checkout & cart links with pre-filled products, quantities and custom prices. Perfect for WhatsApp & chat selling. == Description == **Turn a chat message into a one-click checkout.** CartLink Generator for WooCommerce lets you build a cart for a customer — products, quantities, even custom prices — and share it as a single link. When they open it, the cart is pre-filled and they go straight to checkout. No searching, no adding to cart, no friction. It's built for the way people actually sell today: over **WhatsApp, Instagram DMs, Telegram, Messenger, email and live chat**. Instead of telling a customer "search for product X, add 2, then find product Y," you send them one link that does it all — cutting 3–4 steps out of the buying journey and driving faster conversions. Generate the link in the admin, then share it instantly with the built-in **WhatsApp, Telegram and email buttons**, or let your customer scan the auto-generated **QR code** in person or from a printed flyer. ### Why store owners use it - **Chat commerce & social selling** — send a ready-to-buy cart link in any conversation. - **Direct "Buy Now" links** — skip the cart page entirely and land the customer on checkout. - **Custom quotes & negotiated prices** — set a per-product price or a fixed subtotal discount for a specific customer. - **Sales reps & wholesale** — prepare an order for a client and let them confirm with one tap. - **Campaigns & flyers** — drop a QR code on print or social and send scanners straight to a pre-filled cart. ### Key Features - Create and share dynamic **cart or checkout** links with pre-filled products and quantities. - Set **custom prices** per product or a **fixed subtotal discount** for the whole cart. - **One-click sharing** to WhatsApp, Telegram and email, plus native mobile share. - **QR code** generated for every link — perfect for in-person and print. - **Recent links** management screen: review, copy or revoke any link you've created. - **Live total** preview while you build the cart. - Fast **autocomplete product search** (searches by name and SKU). - Choose link **expiry** (1 day, 7 days, 30 days, 1 year) with automatic cleanup of expired data. - Redirect customers to the **Cart** or **Checkout** page. - Menu placement as a top-level item or under the WooCommerce submenu. - Flexible storage: file-based pseudo-transients or native WordPress transients. - **HPOS (High-Performance Order Storage) compatible.** == Installation == 1. Download and extract the `cartlink-generator` plugin folder. 2. Upload the folder to `/wp-content/plugins/` on your server (or install the ZIP from **Plugins → Add New → Upload Plugin**). 3. Activate the plugin via the WordPress admin dashboard under **Plugins**. 4. Ensure WooCommerce version **8.0 or higher** is active. 5. Open **CartLink Generator** from the admin menu and create your first link. == Use Cases == - **WhatsApp & Instagram sellers** — reply to "I want these two" with a single checkout link. - **Live chat / support teams** — turn a support conversation into a completed sale. - **B2B & wholesale** — pre-build an order at agreed prices and send it for one-tap confirmation. - **Promotions** — share a discounted, ready-to-buy cart for a limited-time offer. - **In-person & print** — print the QR code on a flyer, menu, or packaging insert. == Frequently Asked Questions == = How can I move the CartLink Generator menu to the WooCommerce submenu? = By default, the CartLink Generator menu is added as a top-level menu. To move it under the **WooCommerce** submenu, add the following code to your theme's `functions.php` file: define( 'GUAVEN_CARTLINK_GENERATOR_SHOW_IN_SUBMENU', true ); = Can I redirect customers to the cart page instead of the checkout page? = Yes! To redirect customers to the **Cart** page after using a generated link, add this code to your theme's `functions.php` file: define( 'CARTGENERATOR_REDIRECT_TO_CART_INSTEAD_OF_CHECKOUT', true ); = How does the plugin store generated cart data? = By default, the plugin stores cart data in date-based folders using a file-based pseudo-transient system. If you prefer to use WordPress native transients, define the following constant in your theme's `functions.php` file: define( 'GUAVEN_CARTLINK_GENERATOR_USE_REAL_TRANSIENTS', true ); = Can I allow or restrict coupon usage for carts generated by this plugin? = By default, coupons are restricted for carts generated by the plugin. To enable coupon usage for these carts, define the following constant in your theme's `functions.php` file: define( 'GUAVEN_CARTLINK_GENERATOR_ALLOW_COUPONS', true ); = How does the plugin clean up old data? = The plugin automatically deletes expired carts' data created by the plugin itself. This keeps storage lean and uncluttered. = Can I stop customers from changing quantities in a generated cart? = Yes! To lock quantities for generated carts, add this code to your theme's `functions.php` file: define( 'CARTGENERATOR_FORBID_QUANTITY_UPDATE', true ); = Will old links keep working after I update the plugin? = Yes. Links are looked up by their stored identifier, so any link you have already shared continues to work after updating. = Does it work with product variations? = Yes — variable products and their variations can be added to a generated cart. == Usage == 1. Access **CartLink Generator** from the WordPress admin dashboard. 2. Use the autocomplete search field to find products and add them to the cart configuration. 3. Adjust quantities, custom prices, or apply a fixed subtotal discount as needed. 4. Pick how long the link should stay valid. 5. Click **Generate Link**, then copy it, share it to WhatsApp/Telegram/email, or show the QR code. 6. Review and manage everything you've created from the **Recent links** table. == Minimum Requirements == - WordPress 5.5 or higher. - PHP 7.0 or higher. - WooCommerce 8.0 or higher. == Screenshots == 1. Turn a chat conversation with your customer into a one-click checkout link. 2. Product autocomplete — search by name or SKU and add products in seconds. 3. Admin interface — build the cart, set custom prices and expiry, see the live total. 4. Generated link with instant WhatsApp/Telegram/email sharing and a scannable QR code. 5. The customer opens the link and lands on a pre-filled, ready-to-pay checkout. == Changelog == = 1.1.0 = * New: One-click sharing to WhatsApp, Telegram and email, plus native mobile share sheet. * New: QR code generated for every cart link (bundled locally, no external requests). * New: "Recent links" management table to review, copy and revoke generated links. * New: Live estimated-total preview while building the cart. * New: Per-link expiry presets (1 day / 7 days / 30 days / 1 year). * Fix: Fixed-subtotal discount could leak into a customer's own cart via a lingering session value — it is now scoped to generated carts and cleared when the cart empties. * Fix: Possible fatal error in product search when a result referenced a missing product. * Security: Cart link identifiers are now unguessable (random) so links carrying custom prices cannot be enumerated. Existing links keep working. * Security: AJAX endpoints now require the `manage_woocommerce` capability. * Improvement: Variable products/variations are added to the cart correctly. * Improvement: Configuration constants now honour their value (e.g. `define( X, false )`). * Improvement: Removed an unnecessary full-catalog query on the admin page for faster loads on large stores. * Improvement: Admin styles are now scoped and no longer affect the rest of wp-admin. = 1.0.3 = * Added new feature: preserve query string in URL sharing (UTM params f.i.). = 1.0.2.1 = * Fixing "Fixed Adjustment is always zero" bug. = 1.0.2 = * "Expire-dates are always 1 hour" bug fix * Added new feature - Prevent product quantity update for generated carts. * Delete the trace of cart generator when cart gets emptied. = 1.0.1 = * UI improvements. = 1.0.0 = * Initial release. * Generate dynamic cart links with pre-filled products and quantities. * Options for menu placement and redirection. * Autocomplete product search for efficient cart building. * File-based pseudo-transients with optional native WordPress transients. * Automatic cleanup of old generated cart data. == Upgrade Notice == = 1.1.0 = Adds WhatsApp/Telegram/email sharing, QR codes and a link-management screen. Includes an important fix for a fixed-subtotal discount that could carry over into a customer's own cart. Existing links keep working. == License == This plugin is licensed under the GPL v2 or later. See [License](https://www.gnu.org/licenses/gpl-2.0.html) for details. Bundled QRCode.js library (https://github.com/davidshimjs/qrcodejs) is licensed under the MIT License.