{"id":100,"date":"2026-10-17T14:15:44","date_gmt":"2026-10-17T14:15:44","guid":{"rendered":"http:\/\/plugin-docs.com\/?post_type=doc&#038;p=100"},"modified":"2026-10-17T17:35:05","modified_gmt":"2026-10-17T17:35:05","slug":"woocommerce-add-to-cart","status":"publish","type":"doc","link":"https:\/\/dragwyb.com\/docs\/woocommerce-add-to-cart\/","title":{"rendered":"Configure One-Click Add to Cart"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Dragwyb Click to Chat can display an <strong>Add<\/strong> action on WooCommerce product cards in the AI Assistant. For an in-stock simple product, the plugin builds an add-to-cart URL and opens it in a new browser tab. For other product types, the generated action links to the product page instead, so customers can choose required options before adding the item.<\/p>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Before you begin<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install and activate WooCommerce.<\/li>\n<li>Make sure the product is published and its price, stock status, product type, and permalink are correct.<\/li>\n<li>Activate and configure the Dragwyb AI Assistant so visitors can ask product-related questions.<\/li>\n<li>Use a test product and test account or session when checking cart behavior.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How the Add action works<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The current plugin source does not provide a separate one-click cart setting. The Add action is rendered automatically on a product card when the product data reports that the item is in stock. The destination URL depends on the WooCommerce product type.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Simple product in stock:<\/strong> the plugin creates a product permalink with WooCommerce&#8217;s <code>add-to-cart<\/code> query parameter and the product ID. This requests WooCommerce to add the product using its normal URL-based cart handling.<\/li>\n<li><strong>Other in-stock product types:<\/strong> the product formatter uses the product permalink as the Add action destination. For variable products, customers should use the product page to choose the required variation and options.<\/li>\n<li><strong>Out-of-stock product:<\/strong> the product card does not display the Add action when the returned product data says it is not in stock.<\/li>\n<li><strong>New browser tab:<\/strong> both View and Add links are configured to open in a new tab. The plugin does not perform an in-chat AJAX cart update in this product-card component.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Find the product card in chat<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There is no separate admin page for configuring this Add action. Product cards are shown when the AI conversation returns WooCommerce products. To check the related product-discovery setup:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>In WordPress admin, open <strong>Click to Chat \u2192 AI Assistant<\/strong>.<\/li>\n<li>Choose <strong>Chatbot Settings<\/strong> and open the <strong>Advance<\/strong> tab.<\/li>\n<li>Under <strong>AI Business Tools &amp; Workflow Automation<\/strong>, check the main switch and the <strong>WooCommerce Product Search<\/strong> tool if you want the model to use the dedicated product-search tool. This option is available when WooCommerce is active.<\/li>\n<li>Save the settings using the available save action.<\/li>\n<li>Open a front-end page with the chat widget and ask a product question that matches a published item.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Automatic product context and the optional product-search tool are separate paths. Enabling the tool does not create a separate cart setting; the Add action is part of the product card rendering.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Test adding a simple product<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Choose a published <strong>simple product<\/strong> that is in stock and has a valid price and permalink.<\/li>\n<li>Open the site frontend and ask the AI Assistant to find that product.<\/li>\n<li>Confirm the returned product card matches the product you selected.<\/li>\n<li>Click <strong>Add<\/strong>. The plugin opens the generated URL in a new browser tab.<\/li>\n<li>In that tab, inspect the WooCommerce cart and confirm the expected product was added.<\/li>\n<li>Check the quantity, cart total, and any store notices. Repeat the test with a product that should not match to ensure you can recognize an incorrect result.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Test variable and unavailable products<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For a variable product, the Add link currently falls back to the product permalink rather than selecting a variation inside the chat. Open the product page and choose the required variation there. Also test an out-of-stock product: the Add action should be hidden when the product card&#8217;s stock flag is false.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Cart behavior can also depend on the site&#8217;s WooCommerce configuration, theme, extensions, redirects, and product rules. Verify the result on your own store before describing the action as a guaranteed one-click purchase flow.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>No product card appears:<\/strong> confirm WooCommerce is active, the product is published, and the AI Assistant responds to a specific product-related message. See <a href=\"\/docs\/dragwyb-click-to-chat\/search-woocommerce-products-with-ai\/\">Search WooCommerce Products with AI<\/a>.<\/li>\n<li><strong>The Add action is missing:<\/strong> check whether the product card reports the item as in stock. The component only renders Add when <code>in_stock<\/code> is true.<\/li>\n<li><strong>Add opens the product page instead of adding directly:<\/strong> this is expected for product types other than simple products in the current formatter. Choose required options on the product page.<\/li>\n<li><strong>The cart does not contain the expected item:<\/strong> confirm the URL is for the correct product and inspect WooCommerce notices, cart redirects, product restrictions, and any cart-related extensions.<\/li>\n<li><strong>The displayed stock or price is unexpected:<\/strong> check the current WooCommerce product record and test again with a fresh conversation.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Related WooCommerce guides<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"\/docs\/dragwyb-click-to-chat\/woocommerce-assistant\/\">WooCommerce Shopping and Orders<\/a><\/li>\n<li><a href=\"\/docs\/dragwyb-click-to-chat\/search-woocommerce-products-with-ai\/\">Search WooCommerce Products with AI<\/a><\/li>\n<li><a href=\"\/docs\/dragwyb-click-to-chat\/configure-ai-product-recommendations\/\">Configure AI Product Recommendations<\/a><\/li>\n<li><a href=\"\/docs\/dragwyb-click-to-chat\/woocommerce-order-tracking\/\">Configure Secure WooCommerce Order Tracking<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Screenshot<\/h2>\n\n\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Screenshot to add:<\/strong> Capture a real front-end product card with the Add action, then capture the resulting WooCommerce cart for an in-stock simple product. Hide customer details and other private store information. No screenshot has been captured for this guide yet.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how the WooCommerce Add action works in Dragwyb Click to Chat, test simple products, understand variable-product behavior, and troubleshoot cart issues.<\/p>\n","protected":false},"author":0,"featured_media":0,"parent":97,"menu_order":0,"template":"","class_list":["post-100","doc","type-doc","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/dragwyb.com\/docs\/wp-json\/wp\/v2\/doc\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dragwyb.com\/docs\/wp-json\/wp\/v2\/doc"}],"about":[{"href":"https:\/\/dragwyb.com\/docs\/wp-json\/wp\/v2\/types\/doc"}],"version-history":[{"count":1,"href":"https:\/\/dragwyb.com\/docs\/wp-json\/wp\/v2\/doc\/100\/revisions"}],"predecessor-version":[{"id":364,"href":"https:\/\/dragwyb.com\/docs\/wp-json\/wp\/v2\/doc\/100\/revisions\/364"}],"up":[{"embeddable":true,"href":"https:\/\/dragwyb.com\/docs\/wp-json\/wp\/v2\/doc\/97"}],"wp:attachment":[{"href":"https:\/\/dragwyb.com\/docs\/wp-json\/wp\/v2\/media?parent=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}