Releases: mindkomm/timber-integration-woocommerce
v2.0.0
2.0.0 (2025-04-28)
⚠ BREAKING CHANGES
- Deprecate
theme/woocommerce/views_folderfilter in favor oftimber/woocommerce/views_folder - Deprecate timber/integration/woocommerce/product filter in favor of timber/woocommerce/product (#50)
- Remove
woocommerce_shop_loophook call inProduct::setup()to reduce side effects (#48)
archive-product.twig
🚫 Before
{% if fn('wc_get_loop_prop', 'total') %}
{% for post in posts %}
{##
# Depending on your WooCommerce display settings, the
# `woocommerce_product_subcategories` function might reset the $wp_query global. By
# calling `have_posts()`, we check if there are posts we can display.
#}
{% if fn('have_posts') %}
{{ fn('wc_get_template_part', 'content', 'product' ) }}
{% endif %}
{% endfor %}
{% endif %}✅ After
{% if fn('wc_get_loop_prop', 'total') %}
{% for post in posts %}
{##
# Depending on your WooCommerce display settings, the
# `woocommerce_product_subcategories` function might reset the $wp_query global. By
# calling `have_posts()`, we check if there are posts we can display.
#}
{% if fn('have_posts') %}
{##
# Hook: woocommerce_shop_loop.
#}
{% do action('woocommerce_shop_loop') %}
{{ fn('wc_get_template_part', 'content', 'product' ) }}
{% endif %}
{% endfor %}
{% endif %}Features
- Deprecate
theme/woocommerce/views_folderfilter in favor oftimber/woocommerce/views_folder(ac58e4f) - Deprecate timber/integration/woocommerce/product filter in favor of timber/woocommerce/product (#50) (359eddb)
- Remove
woocommerce_shop_loophook call inProduct::setup()to reduce side effects (#48) (484e621)
Bug Fixes
- Fix bugs when templates are accessed in the WooCommerce status screen (7988120)
v1.1.0
1.0.1
1.0.0
Breaking changes 💥
(More details further down)
- Added support for Timber 2.0 and removed support for Timber 1.x.
- Bumped minimum required PHP version to 7.4.
- Updated how to set up the integration.
- Removed
Product()function in Twig. Useget_post()instead. - Removed
wc_action()Twig function. Use{% do action() %}instead of{% do wc_action() %}.
What’s changed since 1.0.0-rc.1
- Fixed a bug when Twig templates would be falsely rendered on the
system_statusendpoint of the WooCommerce REST API. - Added the possibility to make the WooCommerce system status correctly display outdated WooCommerce templates, even if they are Twig templates.
- Changed Twig template loader to not load views from the caller directory.
Other changes
- Added support for PHP 8.0 and higher.
- Removed custom arguments for the init function in 486766c
- Fixed a bug when context didn’t contain a post for singular product templates in 1a2b3c8
New way to set up integration
🚫 Before
if ( class_exists( 'WooCommerce' ) ) {
\Timber\Integrations\WooCommerce\WooCommerce::init();
}✅ After
add_filter( 'timber/integrations', function ( array $integrations ): array {
$integrations[] = new \Timber\Integrations\WooCommerce\WooCommerceIntegration();
return $integrations;
} );Removed arguments for the integration
If you passed options to the Timber\Integrations\WooCommerce\WooCommerce::init(), you will have to change how you pass them. The new way to init the integration doesn’t take any arguments anymore.
Use a custom class for products
🚫 Before
Timber\Integrations\WooCommerce\WooCommerce::init( [
'product_class' => 'MyProductClass',
] );✅ After
add_filter( 'timber/product/classmap', function( $classmap ) {
$classmap['product'] = 'MyProductClass';
return $classmap;
}, 20 );No more custom product iterator
Post iterators were removed in Timber 2.0. If you’ve used the product_iterator argument, you can use the setup() and teardown() methods on your custom product class instead.
Set a subfolder for the Twig templates
🚫 Before
Timber\Integrations\WooCommerce\WooCommerce::init( [
'subfolder' => 'woo',
] );✅ After
add_filter( 'timber/woocommerce/views_folder', function( $subfolder ) {
return 'woo';
} );Updated Twig functions
🚫 Before
# Getting a product
<img src="{{ Product(id).thumbnail.src|resize(200, 200) }}">
# Calling an action
{% do wc_action('woocommerce_before_shop_loop') %}✅ After
# Getting a product
<img src="{{ get_post(id).thumbnail.src|resize(200, 200) }}">
# Calling an action
{% do action('woocommerce_before_shop_loop') %}Full Changelog: 1.0.0-rc.1...1.0.0
0.8.0
What’s changed
- Fixed a bug when Twig templates would be falsely rendered on the
system_statusendpoint of the WooCommerce REST API. - Added the possibility to make the WooCommerce system status correctly display outdated WooCommerce templates, even if they are Twig templates.
- Changed Twig template loader to not load views from the caller directory.
Full Changelog: 0.7.2...0.8.0
1.0.0-rc.1
You can test this release using
composer require mindkomm/timber-integration-woocommerce:1.0.0-rc.1Breaking changes 💥
(More details further down)
- Added support for Timber 2.0 and removes support for Timber 1.x.
- Bumped minimum required PHP version to 7.4.
- Updated how to set up the integration.
- Removed
Product()function in Twig. Useget_post()instead. - Removed
wc_action()Twig function. Use{% do action() %}instead of{% do wc_action() %}.
What’s changed since 1.0.0-alpha.1
- Removed custom arguments for the init function in 486766c
- Fixed a bug when context didn’t contain a post for singular product templates in 1a2b3c8
Full Changelog: 1.0.0-alpha.1...1.0.0-rc.1
Other changes
- Added support for PHP 8.0 and higher.
New way to set up integration
🚫 Before
if ( class_exists( 'WooCommerce' ) ) {
\Timber\Integrations\WooCommerce\WooCommerce::init();
}✅ After
add_filter( 'timber/integrations', function ( array $integrations ): array {
$integrations[] = new \Timber\Integrations\WooCommerce\WooCommerceIntegration();
return $integrations;
} );Removed arguments for the integration
If you passed options to the Timber\Integrations\WooCommerce\WooCommerce::init(), you will have to change how you pass them. The new way to init the integration doesn’t take any arguments anymore.
Use a custom class for products
🚫 Before
Timber\Integrations\WooCommerce\WooCommerce::init( [
'product_class' => 'MyProductClass',
] );✅ After
add_filter( 'timber/product/classmap', function( $classmap ) {
$classmap['product'] = 'MyProductClass';
return $classmap;
}, 20 );No more custom product iterator
Post iterators were removed in Timber 2.0. If you’ve used the product_iterator argument, you can use the setup() and teardown() methods on your custom product class instead.
Set a subfolder for the Twig templates
🚫 Before
Timber\Integrations\WooCommerce\WooCommerce::init( [
'subfolder' => 'woo',
] );✅ After
add_filter( 'timber/woocommerce/views_folder', function( $subfolder ) {
return 'woo';
} );Updated Twig functions
🚫 Before
# Getting a product
<img src="{{ Product(id).thumbnail.src|resize(200, 200) }}">
# Calling an action
{% do wc_action('woocommerce_before_shop_loop') %}✅ After
# Getting a product
<img src="{{ get_post(id).thumbnail.src|resize(200, 200) }}">
# Calling an action
{% do action('woocommerce_before_shop_loop') %}0.7.2
What’s changed
- Fixed deprecation warning in PHP 8.1 by @kristjankoppel in #36
- Added license file by @szepeviktor in #31
- Updated export to not include the documentation @szepeviktor in #32
New Contributors
- @szepeviktor made their first contribution in #31
- @kristjankoppel made their first contribution in #36
Full Changelog: 0.7.1...0.7.2
1.0.0-alpha.1
You can test this release using
composer require mindkomm/timber-integration-woocommerce:1.0.0-alpha.1Breaking changes 💥
- Added support for Timber 2.0 and removes support for Timber 1.x.
- Bumped minimum required PHP version to 7.4.
- Updated how to set up the integration.
- Removed
Product()function in Twig. Useget_post()instead. - Removed
wc_action()Twig function. Use{% do action() %}instead of{% do wc_action() %}.
Other changes
- Added support for PHP 8.0 and higher.
New way to set up integration
🚫 Before
if ( class_exists( 'WooCommerce' ) ) {
Timber\Integrations\WooCommerce\WooCommerce::init();
}✅ After
add_filter( 'timber/integrations', function ( array $integrations ): array {
$integrations[] = new \Timber\Integrations\WooCommerce\WooCommerceIntegration();
return $integrations;
} );Updated Twig functions
🚫 Before
# Getting a product
<img src="{{ Product(id).thumbnail.src|resize(200, 200) }}">
# Calling an action
{% do wc_action('woocommerce_before_shop_loop') %}✅ After
# Getting a product
<img src="{{ get_post(id).thumbnail.src|resize(200, 200) }}">
# Calling an action
{% do action('woocommerce_before_shop_loop') %}Full Changelog: 0.7.1...1.0.0-beta.1