Fourthwall moved the product title from <h2> to <h1>, which silently emptied [fourthwall_single] and [fourthwall_random]: both gated rendering on a title match that could no longer succeed. Verified against a live store. Parsing - Read schema.org JSON-LD first, falling back to scraped markup field by field, then to og: meta tags. Each field degrades independently, so a future markup change can only affect what it actually touched. - Match CSS classes with a padded contains() predicate instead of @class="...", and select on data-testid where available. Exact class matching is what broke. - Surface sku, availability and currency, which were previously discarded. Product discovery - Enumerate products from sitemap.xml rather than scraping the store page, which only sees the collection it features. [fourthwall_random count="10"] could not return more than the 3 items a featured homepage renders. - New source="auto|sitemap|page" attribute. Off-host <loc> entries are rejected so a hostile sitemap cannot redirect fetches. Caching - Stale-while-revalidate: stale entries are served immediately and refreshed by WP-Cron, so cache expiry never costs a visitor a network round trip. - Refresh scheduling dedupes via wp_next_scheduled and takes a lock, collapsing a stampede to a single job. - Fetch uncached product pages concurrently with curl_multi instead of serially. - Cache lifetime is now configurable (default 60 minutes). - Entries written by earlier versions are read as stale and upgraded in place, so caches turn over without blanking a store. Fixes - Build absolute product links properly. "/collections/all" + "/products/x" produced 404s; a trailing slash produced "//products/x". - Escape the price on output; it was interpolated raw. - strpos() misuse meant an error string at offset 0 was treated as success. - Guard a null description node that would fatal when show_description="true". - Report non-200 responses instead of caching an empty body silently. - Drop the shared /tmp/cookies.txt jar. It was cross-site mutable state and made concurrent fetching unsafe; all endpoints return 200 without it. - Remove the ssl_verify setting. It was a development affordance and its checkbox never worked - unchecked meant "key absent", which read as true. Certificate verification is now pinned on. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
5.6 KiB
Fourthwall Store Embed WordPress Plugin
A WordPress plugin to embed Fourthwall Store products in your WordPress site.
Shortcodes
Display All Store Products
[fourthwall]
Displays all products from your Fourthwall store.
Display Single Product
[fourthwall_single url="https://your-store.com/product-url" show_description="true"]
Displays a single product with optional description.
Parameters:
url(required): The full URL of the productshow_description(optional): Set to "true" to show product description
Display Random Products
[fourthwall_random count="5"]
Displays a random selection of products from your store.
Parameters:
count(optional): Number of products to display (default: 3)urls(optional): Comma-separated list of specific product URLs to randomize fromstore_url(optional): Custom store URL (uses default from settings if not provided)source(optional): Where to discover products -auto(default),sitemap, orpage
About source: products are discovered from your store's sitemap.xml, which
lists your entire catalog. The older behaviour scraped the store page, which only
sees the collection that page happens to feature - so if your homepage shows 3
featured items, count="10" could never return more than 3. auto uses the
sitemap and falls back to scraping the page if the sitemap is unavailable; use
page to force the old behaviour.
Examples:
Random 5 products from all store products:
[fourthwall_random count="5"]
Random 3 products from specific URLs:
[fourthwall_random count="3" urls="https://store.com/product1,https://store.com/product2,https://store.com/product3"]
Random 2 products from a different store:
[fourthwall_random count="2" store_url="https://different-store.com"]
Installation
- Upload the plugin files to
/wp-content/plugins/fourth-wall-embed-wp/ - Activate the plugin through the 'Plugins' menu in WordPress
- Go to Settings > Fourthwall Store Embed to configure your store URL
Configuration
In the WordPress admin, go to Settings > Fourthwall Store Embed to set your Fourthwall store URL.
Cache Lifetime (default: 60 minutes) controls how often store content is refreshed. Content is cached and served instantly; once it passes the lifetime it is still served immediately while a background refresh runs, so raising or lowering this never slows a page down. Use Clear Cache to force an immediate refresh after changing products in Fourthwall.
Features
- Caches requests for better performance
- Responsive design
- Error handling for failed requests
- Random product selection
- Support for multiple store URLs
How to use the plugin
- Download the latest release from releases
- Upload the Plugin to WordPress
- In the WordPress Dashboard, Navigate to the Fourthwall settings page, and paste your store URL.
Configuration Options
Store URL: Enter your Fourthwall store URL (e.g., https://your-store.fourthwall.com)
Cache Lifetime: How long store content stays fresh, in minutes (default: 60)
Cache Management:
- Content is cached and served instantly, then refreshed in the background
- Use the "Clear Cache" button if products are not updating
Display your entire store
To display your entire Fourthwall store on a page, use the shortcode:
[fourthwall]
Display a single product
To display an individual product from your Fourthwall store, use the shortcode with the product URL:
[fourthwall_single url="https://your-store.fourthwall.com/products/product-name"]
You can also display the product description by setting the show_description attribute to "true":
[fourthwall_single url="https://your-store.fourthwall.com/products/product-name" show_description="true"]
Features
- Smart Caching: Stale content is served instantly while it refreshes in the background, so cache expiry never slows a page down
- Parallel Fetching: Uncached products are fetched concurrently rather than one at a time
- Error Handling: Graceful fallbacks and clear error messages
- Admin Interface: User-friendly settings page with clear instructions
- Cache Management: Manual cache clearing for troubleshooting
- Responsive Design: CSS styling for both frontend and admin areas
Requirements
- WordPress 6.0 or higher
- PHP 7.4 or higher
- Active Fourthwall store
- cURL extension enabled
Performance Notes
- Content is cached to reduce requests to Fourthwall (default: 60 minutes)
- Once the cache lifetime passes, content is still served instantly while a background refresh runs, so visitors never wait on the network
- Manual cache clearing available in admin settings
Troubleshooting
Products not updating?
- Clear the cache using the "Clear Cache" button in admin settings
- Check your store URL is correct
- Lower the Cache Lifetime if you need changes to appear sooner
Background refreshes not happening?
- Refreshes run via WP-Cron. If
DISABLE_WP_CRONis set with no system cron configured, content is served stale until it is refetched on demand.
403 Forbidden errors?
- Fourthwall may be blocking automated requests
- Check if your store is publicly accessible
- Contact Fourthwall support if issues persist
This plugin allows you to integrate your Fourthwall store directly into your WordPress site, either showing your complete product collection or featuring specific products individually.
If you can think of things that could be improved or find any bugs, please open an issue on the repository.