Skip to content

Template overrides

Template system modeled after WooCommerce. Override any template by copying it to yourtheme/polski/ in your theme.

  1. Find the original template in the plugin directory: wp-content/plugins/polski/templates/
  2. Copy the file to your theme directory: wp-content/themes/your-theme/polski/
  3. Preserve the subdirectory structure
  4. Modify the copied file

The plugin will automatically detect the template in your theme and use it instead of the default.

Example: to override the Omnibus price template, copy:

wp-content/plugins/polski/templates/omnibus/price-display.php

to:

wp-content/themes/your-theme/polski/omnibus/price-display.php

If you use a child theme, place templates in the child theme directory. The plugin searches for templates in the following order:

  1. wp-content/themes/child-theme/polski/
  2. wp-content/themes/parent-theme/polski/
  3. wp-content/plugins/polski/templates/
Template fileDescription
omnibus/price-display.phpOmnibus price display
omnibus/price-history.phpPrice history (table)
gpsr/product-info.phpGPSR information on product page
gpsr/safety-sheet.phpProduct safety data sheet
withdrawal/form.phpContract withdrawal form
withdrawal/confirmation.phpWithdrawal submission confirmation
withdrawal/email.phpConfirmation email template
dsa/report-form.phpDSA report form
dsa/report-confirmation.phpDSA report confirmation
gdpr/consent-checkboxes.phpGDPR consent checkboxes
ksef/invoice-template.phpKSeF invoice template
greenwashing/product-claims.phpProduct environmental claims
legal-pages/terms-template.phpStore terms and conditions template
legal-pages/privacy-template.phpPrivacy policy template
legal-pages/withdrawal-template.phpWithdrawal information template
Template fileDescription
prices/unit-price.phpUnit price
prices/vat-notice.phpVAT and delivery information
prices/delivery-time.phpEstimated delivery time
manufacturer/info.phpManufacturer information
manufacturer/logo.phpManufacturer logo
Template fileDescription
food/nutrients-table.phpNutrition facts table
food/allergens-list.phpAllergens list
food/nutri-score.phpNutri-Score badge
Template fileDescription
checkout/button-label.phpOrder button label
checkout/legal-checkboxes.phpLegal checkboxes at checkout
checkout/nip-field.phpNIP field with auto-completion
checkout/doi-notice.phpDouble opt-in message
Template fileDescription
wishlist/table.phpWishlist table
wishlist/button.phpAdd to list button
wishlist/header-icon.phpHeader icon
compare/table.phpComparison table
compare/button.phpCompare button
compare/floating-bar.phpComparison bar (bottom of screen)
quick-view/modal.phpQuick view lightbox window
quick-view/button.phpQuick view button
ajax-search/form.phpAJAX search field
ajax-search/results.phpSearch results dropdown
ajax-search/result-item.phpSingle search result
ajax-filters/container.phpAJAX filters container
ajax-filters/filter-category.phpCategory filter
ajax-filters/filter-price.phpPrice filter (slider)
ajax-filters/filter-attribute.phpAttribute filter
ajax-filters/active-filters.phpActive filters bar
product-slider/slider.phpSlider container
product-slider/item.phpProduct card in slider
badges/badge.phpSingle badge
badges/container.phpBadge container on product
waitlist/form.phpWaitlist form
waitlist/email.phpAvailability notification email
Template fileDescription
tools/compliance-checklist.phpCompliance checklist
tools/audit-report.phpAudit report
tools/security-incident-form.phpSecurity incident form
tools/verified-review-badge.phpVerified review badge

Each template receives a set of variables. Example for omnibus/price-display.php:

<?php
/**
* Omnibus price display template
*
* Available variables:
* @var float $lowest_price Lowest price from the period
* @var int $days Number of days
* @var int $product_id Product ID
* @var string $price_html Formatted price HTML
* @var string $date Lowest price date
*
* @package Polski
*/
defined('ABSPATH') || exit;
?>
<div class="polski-omnibus-price">
<span class="polski-omnibus-label">
<?php printf(
esc_html__('Lowest price from %d days before the discount:', 'polski'),
$days
); ?>
</span>
<span class="polski-omnibus-amount">
<?php echo wp_kses_post($price_html); ?>
</span>
</div>

Each template contains a @version comment in the header. After updating the plugin, check if your overridden templates need updating.

The plugin displays a warning in the admin panel (WooCommerce > Status > Polski) if it detects outdated templates in the theme.

/**
* @version 1.5.0
*/

If you want to change the default template location in the theme:

add_filter('polski/template/path', function (string $path): string {
return 'custom-polski-templates/'; // instead of 'polski/'
});

Then templates will be searched in: wp-content/themes/your-theme/custom-polski-templates/

To check which template is currently being loaded, enable debug mode:

// In wp-config.php
define('POLSKI_TEMPLATE_DEBUG', true);

In debug mode, each template is surrounded by HTML comments indicating the path:

<!-- polski template: /themes/your-theme/polski/omnibus/price-display.php -->
...
<!-- /polski template -->

Report issues: github.com/wppoland/polski/issues

This page is for informational purposes only and does not constitute legal advice. Consult a lawyer before implementation. Polski for WooCommerce is open source software (GPLv2) provided without warranty.