Skip to content

Conversation

@DevWael
Copy link
Contributor

@DevWael DevWael commented Nov 14, 2025

This PR introduces a new feature for the Product Labels module, allowing users to display multiple labels on a single product. Previously, only one product label could be displayed at a time, even if multiple conditions were met. See #519

With this update, users can:

  • Enable or disable the multiple labels feature.
  • Define a global position for all displayed labels (e.g., top-left, top-right), overriding individual label position settings.
  • Configure spacing between multiple labels (right, left, top, bottom).
  • Set a maximum number of labels to display per product.

The styling has been updated to support a horizontal flexbox layout for multiple labels, ensuring proper alignment and shape rendering for individual labels. Shortcode replacements ({sale}, {sale_amount}, etc.) are now applied to all matching labels.

This change significantly enhances the flexibility and visual communication capabilities of product labels.

How to test:

  1. Go to Merchant > Product Labels.
  2. Enable the "Product Labels" module.
  3. Create several product labels with different display rules (e.g., one for "On Sale", one for "New Products", one for a specific category). Ensure these labels would apply to the same product.
  4. Go to the new "Multiple Labels" section in the module settings.
  5. Enable the "Enable multiple labels" switcher.
  6. Configure the "Labels position" (e.g., "Top left").
  7. Adjust "Spacing right", "Spacing left", "Spacing top", "Spacing bottom" to observe their effect.
  8. Set "Maximum labels per product" to a value like 2 or 3.
  9. Navigate to a product page on the frontend that should display multiple labels based on your setup.
  10. Verify:
    • Multiple labels are displayed on the product.
    • They adhere to the globally set position (e.g., top-left).
    • The spacing between labels is applied correctly.
    • The total number of labels displayed does not exceed the "Maximum labels per product" setting.
    • Labels with shapes (e.g., text-shape-2, text-shape-3) render correctly when multiple labels are active.
    • Shortcodes within the labels (e.g., {sale}) are correctly replaced with product-specific data.
  11. Disable the "Enable multiple labels" switcher.
  12. Verify: Only one label is displayed (the first one that matches the conditions), reverting to the old behavior.

@DevWael DevWael self-assigned this Nov 14, 2025
@DevWael DevWael added enhancement New feature or request risk:2-medium labels Nov 14, 2025
@DevWael
Copy link
Contributor Author

DevWael commented Nov 17, 2025

Closed based on Shuvo's feedback. There will be another implementation in #544

@DevWael DevWael closed this Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request risk:2-medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants