Skip to content

Shortcodes

Polski for WooCommerce registers 36 shortcodes that print legal notices, product information and storefront modules anywhere a shortcode runs. Product shortcodes take one optional attribute, product (a product ID), and otherwise use the current product. A shortcode whose module is switched off prints nothing, so it is safe to leave in content.

All of these accept product="123". Without it they use the global $product, which is set on single product pages and in product loops. A product the visitor cannot view, or a page with no product, gives empty output.

Shortcode What it prints
[polski_unit_price] Unit price (e.g. price per kg or litre)
[polski_omnibus_price] Lowest price from the last 30 days (Omnibus)
[polski_tax_notice] VAT rate notice, or the exemption text under Art. 113 of the VAT Act (VAT display)
[polski_delivery_time] Delivery time set for the product
[polski_manufacturer] Manufacturer information
[polski_gpsr] GPSR product safety section, when the GPSR module is on
[polski_safety_info] Safety instructions, under a “Safety instructions” heading
[polski_safety_docs] Safety documents attached to the product
[polski_power_supply] Power supply information
[polski_defect_description] Description of the product’s defect
[polski_nutrients] Nutrition facts table (nutrients)
[polski_allergens] Allergen list
[polski_ingredients] Ingredient list
[polski_nutri_score] Nutri-Score rating
[polski_food_info] Combined food information block

Example:

[polski_omnibus_price product="456"]

These take no attributes.

Shortcode What it prints
[polski_shipping_notice] Shipping costs notice
[polski_payment_methods] “Available payment methods” list
[polski_small_business_notice] VAT exemption notice for small businesses, when the shop is set as exempt
[polski_complaints] Out-of-court dispute resolution notice, when the dispute resolution module is on
Shortcode Module Attributes (default)
[polski_business_info] Business info format (block), separator (|), show_label (1), show_regon (0), show_bdo (0)
[polski_bdo] BDO show_label (1), label (empty)
[polski_copyright] Copyright notice owner, year, license (all empty), separator (-)
[polski_image_credit] Copyright notice image_id, credit, source, license (all empty), size (medium)

Example:

[polski_business_info show_regon="1" show_bdo="1"]
Shortcode Module What it prints
[polski_withdrawal_form] Withdrawal Withdrawal form for one order; attribute order_id (default 0)
[polski_withdrawal_lookup] Withdrawal Order lookup for guests, which emails a link to the withdrawal form
[polski_withdrawal_info] Withdrawal Information on the right of withdrawal
[polski_withdrawal_form_template] Withdrawal Model withdrawal form
[polski_complaint_template] Complaint template Complaint form template
[polski_dsa_report] DSA Form for reporting illegal content

[polski_withdrawal_form] checks the order before it shows anything: without an order number it asks for one, an order the visitor may not see reads “We could not find that order.”, and an order outside the withdrawal rules reads “This order does not qualify for withdrawal.”

Shortcode Module Attributes (default)
[polski_wishlist] Wishlist none
[polski_compare] Compare none
[polski_compare_count] Compare none; prints the number of products in the comparison
[polski_ajax_search] AJAX search none; uses the module settings
[polski_ajax_filters] AJAX filters title, show_title, show_categories, show_brands, show_price, show_stock, show_sale, show_attributes, show_active_filters, show_counts, enable_mobile_panel, enable_instant_filtering, enable_taxonomy_multiselect, taxonomy_multi_select_relation, max_attribute_taxonomies, attribute_taxonomies; each one left out falls back to the module setting
[polski_product_slider] Product slider source (related, upsell, sale or featured), title, limit; defaults come from the module settings
[polski_faq] FAQ category (empty), limit (-1, all), schema (yes)

Example:

[polski_product_slider source="sale" limit="12" title="Promotions"]

See product slider for the module settings.

All shortcodes can be called in PHP templates:

// Single shortcode
echo do_shortcode('[polski_omnibus_price]');
// Shortcode with parameters
echo do_shortcode('[polski_product_slider source="featured" limit="6"]');
// Conditional display
if (shortcode_exists('polski_gpsr')) {
echo do_shortcode('[polski_gpsr]');
}

In the Gutenberg editor, use the Shortcode block and paste the desired shortcode.

How do I show a product’s data outside its product page?

Section titled “How do I show a product’s data outside its product page?”

Pass the product ID: [polski_unit_price product="123"]. The attribute is product for every product shortcode.

Its module is switched off in Polski > Modules, the page has no current product and no product attribute, or the product has no data for that field.

Can I check whether a shortcode exists before calling it?

Section titled “Can I check whether a shortcode exists before calling it?”

Yes, with WordPress’s shortcode_exists(), as in the PHP example above. The plugin keeps a module’s shortcode registered while the module is off, with empty output, so the check tells you whether Polski is active.

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.