Skip to content

Commit

Permalink
#24 Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gchtr committed Aug 4, 2021
1 parent e1cc8b2 commit a71834b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 0.6.1 - 2021-08-04

- Fixed a couple of issues with `$product` global not being kept in sync.
- Added small improvements in documentation.

## 0.6.0 - 2021-04-13

Expand Down
8 changes: 6 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ So, if you want to control how WooCommerce’s content is wrapped, you can edit

Read on if you want to know how you can override WooCommerce’s default templates.

## Optional: add woocommerce.php
## Optional: Add woocommerce.php

A **woocommerce.php** file that is placed into the root of your theme has priority over all other templates that you place in the `woocommerce/` folder of your theme. For example, **woocommerce.php** will take precedence over **woocommerce/archive-product.php**. If you use this file, WooCommerce will always use this file to render shop templates.

Expand All @@ -84,6 +84,10 @@ Timber\Integrations\WooCommerce\WooCommerce::render_default_template();

The function `render_default_template()` makes it possible for you to render the default files used by WooCommerce. If you have more complex functionality that you need to apply, you can also copy the contents of the `render_default_template()` function into **woocommerce.php** directly and adapt it there.

If you don’t add a **woocommerce.php** file, you can still replace template parts that are loaded through `wc_get_template()` or `wc_get_template_part()`, but not whole templates.

### $context

If you want to add additional context variables to your shop pages, you can either use the `timber/context` filter or pass in a context directly to `render_default_template()`

**woocommerce.php**
Expand All @@ -102,7 +106,7 @@ WooCommerce::render_default_template( $context );

The `$context` that you pass in here will be merged with the default Timber context.

## Optional: copy default templates to your theme
## Optional: Copy default templates to your theme

In the **defaults** folder of the integration, you’ll find [default Twig templates](https://github.com/MINDKomm/timber-integration-woocommerce/tree/master/defaults) for a couple of WooCommerce templates. They are examples for how you could translate templates from PHP to Twig.

Expand Down

0 comments on commit a71834b

Please sign in to comment.