Skip to content

Releases: mindkomm/timber-integration-woocommerce

v1.1.0

10 Sep 06:32
ff6a3a6
Compare
Choose a tag to compare

1.1.0 (2024-09-10)

Features

  • Add timber/woocommerce/views_folder filter (4c0222c), see #43

Bug Fixes

  • docs: Update Getting Started guide with recommended way of initializing the integration (#45) (4de815c)

1.0.1

28 May 15:27
Compare
Choose a tag to compare

Bugfixes

  • Fixed a compatibility bug with Timber 2.2.0.

1.0.0

08 May 09:59
bddcccb
Compare
Choose a tag to compare

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. Use get_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_status endpoint 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

14 Feb 13:07
Compare
Choose a tag to compare

What’s changed

  • Fixed a bug when Twig templates would be falsely rendered on the system_status endpoint 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

29 Jan 14:55
Compare
Choose a tag to compare
1.0.0-rc.1 Pre-release
Pre-release

You can test this release using

composer require mindkomm/timber-integration-woocommerce:1.0.0-rc.1

Breaking 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. Use get_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

29 Jan 14:54
Compare
Choose a tag to compare

What’s changed

New Contributors

Full Changelog: 0.7.1...0.7.2

1.0.0-alpha.1

03 Jan 20:03
Compare
Choose a tag to compare
1.0.0-alpha.1 Pre-release
Pre-release

You can test this release using

composer require mindkomm/timber-integration-woocommerce:1.0.0-alpha.1

Breaking 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. Use get_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

0.7.1

13 Jan 16:48
Compare
Choose a tag to compare
  • Fixed a bug when product global is not present on singular product pages.

0.7.0

13 Jan 13:06
Compare
Choose a tag to compare
  • Updated PHP requirements to allow PHP 8.0 and higher.

0.6.1

13 Jan 13:06
Compare
Choose a tag to compare
  • Fixed a couple of issues with $product global not being kept in sync.
  • Added improvements to documentation.