Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.6.2] - 2026-06-20

### Fixed

**WooCommerce Function Guards:**
- Added `function_exists()` checks around all WooCommerce-specific functions in `functions.php`
- Prevents fatal errors on sites running Elayne without WooCommerce installed (e.g., aseonomics.com)
- Guards added to: `is_shop()`, `is_product_category()`, `is_product_tag()`, `is_product()`, `wc_get_product()`, `WC()`
- Category filter drawer script now safely skips enqueue when WooCommerce functions are unavailable
- Product structured data generation now validates `WC()->structured_data` exists before calling methods

## [4.6.1] - 2026-06-16

### Changed
Expand Down
14 changes: 11 additions & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ function elayne_enqueue_category_filter_drawer() {
return;
}
// Load on shop page, product category archives, product tag archives, and any product taxonomy.
if ( is_shop() || is_product_category() || is_product_tag() || is_tax( 'product_cat' ) || is_tax( 'product_tag' ) ) {
if ( ( function_exists( 'is_shop' ) && is_shop() ) ||
( function_exists( 'is_product_category' ) && is_product_category() ) ||
( function_exists( 'is_product_tag' ) && is_product_tag() ) ||
is_tax( 'product_cat' ) ||
is_tax( 'product_tag' ) ) {
wp_enqueue_script(
'elayne-category-filter-drawer',
get_template_directory_uri() . '/assets/js/category-filter-drawer.js',
Expand Down Expand Up @@ -137,13 +141,17 @@ function () {
* output_structured_data() still runs on wp_footer.
*/
function elayne_add_product_structured_data() {
if ( ! is_product() ) {
if ( ! function_exists( 'is_product' ) || ! is_product() ) {
return;
}

if ( ! function_exists( 'wc_get_product' ) ) {
return;
}

$product = wc_get_product( get_the_ID() );

if ( $product instanceof \WC_Product ) {
if ( $product instanceof \WC_Product && function_exists( 'WC' ) && isset( WC()->structured_data ) ) {
WC()->structured_data->generate_product_data( $product );
}
}
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: block-patterns, block-styles, blog, custom-colors, custom-logo, custom-men
Requires at least: 6.6
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 4.6.1
Stable tag: 4.6.2
License: GNU General Public License v3.0 (or later)
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -174,6 +174,11 @@ Elayne includes custom image sizes optimized for different layouts:

== Changelog ==

= 4.6.2 - 06/20/26 =
* FIXED: Added function_exists() guards around all WooCommerce functions to prevent fatal errors on non-WooCommerce sites.
* FIXED: Category filter drawer safely skips enqueue when WooCommerce is not active.
* FIXED: Product structured data generation validates WC() and structured_data availability before use.

= 4.6.1 - 06/16/26 =
* CHANGED: Theme description rewritten for WordPress.org discoverability — leads with theme name, action-oriented copy, reordered selling points, added Global Styles callout and demo link.
* FIXED: Pattern count in style.css description corrected from 110+ to 125+.
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: Elayne is a premium full-site-editing block theme for professional
Requires at least: 6.6
Tested up to: 7.0
Requires PHP: 8.0
Version: 4.6.1
Version: 4.6.2
License: GNU General Public License v3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: elayne
Expand Down
Loading