Skip to content

Commit

Permalink
fix(docs): Update Getting Started guide with recommended way of initi…
Browse files Browse the repository at this point in the history
…alizing the integration (#45)
  • Loading branch information
gchtr authored Sep 9, 2024
1 parent 3fa43c8 commit 4de815c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,18 @@ You could either loosely add theme support and the initialization call for the i
```php
<?php

use Timber\Integrations\WooCommerce\WooCommerceIntegration;

class WooCommerceTheme {
/**
* Inits all hooks.
*/
public function init() {
if ( class_exists( 'WooCommerce' ) ) {
\Timber\Integrations\WooCommerce\WooCommerce::init();
}
add_filter( 'timber/integrations', function ( array $integrations ): array {
$integrations[] = new WooCommerceIntegration();

return $integrations;
} );

// Optional: Disable default WooCommerce image functionality.
// Timber\Integrations\WooCommerce\WooCommerce::disable_woocommerce_images();
Expand Down

0 comments on commit 4de815c

Please sign in to comment.