WooCommerce Integration & Direct Sales
This guide explains how to turn your book showcase into a fully functional bookstore. By integrating with WooCommerce, you can sell physical books, e-books, or audiobooks directly from your book detail pages.
Overview
This integration allows you to:
- Link a specific Book to a WooCommerce Product.
- Sell the book directly from the Book Detail page (with Price & Add to Cart button).
- Hide the actual WooCommerce Product from the shop catalog (optional), keeping the focus on your custom Book page.
- Auto-Redirect users from the Product page back to the Book page.
How to Setup (Step-by-Step)
1. Create a Product
First, go to Products > Add New and create a product for your book.
- It can be a Simple Product (single price) or a Variable Product (e.g., Hardcover, PDF, Kindle options).
- Add the price and manage stock as usual.
- Note: You do not need to add a description or image here if you plan to hide this product from the catalog.
2. Link Book to Product
Now, go to Books > All Books and edit the book you want to sell.
- Look for the “Linked WooCommerce Product” box in the right sidebar.
- Select Product: Choose the product you created in step 1 from the dropdown menu.
- Hide from Catalog: Check the box “Hide this product from WooCommerce Shop/Catalog?”.
- Recommended: Checking this ensures the product doesn’t appear twice on your site (once as a Book, once as a Product). It will only be purchasable via the Book page.
- Update/Publish the book.
Frontend Features & Experience
Once linked, the plugin automatically enhances the user experience:
1. Seamless Shopping Experience
- Direct Add to Cart: The Book page will display the Price and an “Add to Cart” button (or variation dropdowns).
- AJAX Cart & Modal: When a user clicks “Add to Cart”, the page will not reload. Instead, a beautiful popup modal will appear confirming the item was added, with options to “Continue Shopping” or “View Cart”.
2. Smart Redirection (301)
If a user or search engine accidentally finds the direct link to the WooCommerce Product page, they will be automatically redirected to your beautiful Book Detail page. This improves SEO and keeps traffic on the correct page.
3. Name & Link Sync
Even inside the Cart, Checkout, and Mini-Cart, the system overrides the default Product Name. It will display the Book Title instead of the Product Name, ensuring consistency for the customer.
Shortcodes (For Custom Layouts)
While the plugin automatically inserts these elements into the default template, you can use these shortcodes if you are building a custom layout (e.g., via Elementor or Block Editor):
| Shortcode | Description |
[rswpbs_book_price] | Displays the price. Handles price ranges for variable products automatically (e.g., $10 - $20). |
[rswpbs_book_cart] | Displays the full “Add to Cart” form. Supports both Simple and Variable products (with dropdowns). |
[rswpbs_book_loop_btn] | Displays a simple “Add to Cart” button, suitable for archive/loop pages. |
๐ Important Notes
- Variable Products: The integration fully supports Variable Products. Users can select options (like “Format: Hardcover”) directly on the book page.
- Protection: The system includes crash protection to prevent errors if a linked product is deleted or set to draft.
Was this article helpful?