pollora / woocommerce
WooCommerce for Pollora: its Blade templates, its template resolution, the Coming Soon page, its route conditions and its WordPress events as Laravel events.
Requires
- php: ^8.3
- illuminate/contracts: ^13.38
- illuminate/support: ^13.38
- pollora/framework: ^13.39
- pollora/hook: ^2.0.1
Requires (Dev)
- antecedent/patchwork: ^2.2
- brain/monkey: ^2.7
- johnbillion/extended-cpts: ^5.0.3
- laravel/pint: ^1.22.1
- mockery/mockery: ^1.6.12
- pestphp/pest: ^3.8.2
- php-stubs/woocommerce-stubs: ^11.2
- php-stubs/wordpress-stubs: ^7.1
- phpstan/phpstan: ^2.1.16
- pollora/harness: ^0.1.7
- szepeviktor/phpstan-wordpress: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-27 16:36:44 UTC
README
Pollora WooCommerce
WooCommerce for Pollora, the Laravel framework for WordPress: write the shop's templates in Blade, answer Route::wp('shop') and Route::wp('product'), render the Coming Soon page from your theme, and listen to WooCommerce's orders, taxes and attributes as Laravel events.
This used to live in the framework, as
Pollora\ThirdParty\WooCommerce. The old class names still resolve, to this package.
Installation
composer require pollora/woocommerce
Requires PHP 8.3+, pollora/framework 13.39+ and WooCommerce. The service provider is discovered by Laravel; nothing runs unless WooCommerce is active.
Blade templates
WooCommerce looks for a template in the theme, then in its own folder. The package adds the Blade variant of each candidate to the search, so resources/views/woocommerce/single-product.blade.php answers where woocommerce/single-product.php would, and a child theme's override folder is honoured. Template parts (wc_get_template_part) and wc_get_template resolve the same way.
Filter pollora/woocommerce/template_paths to add a folder to the search.
Route conditions
Route::wp() knows WooCommerce's conditionals:
Route::wp('shop', [ShopController::class, 'index']); Route::wp('product', [ProductController::class, 'show']);
| Alias | Condition |
|---|---|
shop |
is_shop |
product |
is_product |
cart |
is_cart |
checkout |
is_checkout |
account |
is_account_page |
product_category |
is_product_category |
product_tag |
is_product_tag |
wc_endpoint |
is_wc_endpoint_url |
A project's own wordpress.plugin_conditions.woocommerce entries win over these defaults.
Coming Soon page
WooCommerce renders its Coming Soon page itself and exits, which skips Blade. With a view woocommerce.coming-soon in your theme (or woocommerce.coming-soon-store-only when only the store pages are hidden), the package renders that instead.
Events
WooCommerce's actions arrive as Laravel events, in Pollora\WooCommerce\Events:
| Event | From |
|---|---|
OrderStatusChanged |
woocommerce_order_status_changed |
AttributeCreated, AttributeUpdated, AttributeDeleted |
woocommerce_attribute_* |
TaxRateCreated, TaxRateUpdated, TaxRateDeleted |
woocommerce_tax_rate_* |
SettingUpdated |
WooCommerce options (updated_option) |
Event::listen(OrderStatusChanged::class, function (OrderStatusChanged $event): void { $event->order; // WC_Order $event->newStatus; });
Coming from the framework
The classes moved:
| Was | Is |
|---|---|
Pollora\ThirdParty\WooCommerce\… |
Pollora\WooCommerce\… |
Pollora\Events\WordPress\Plugins\WooCommerce\… |
Pollora\WooCommerce\Events\… |
The old names keep working and are removed in the next major release. Install the package: a framework that no longer ships WooCommerce does nothing for it without this one.
License
MIT. See LICENSE.