Home Forums WoodMart support forum WoodMart 8.5.0: attribute product labels not all rendered

WoodMart 8.5.0: attribute product labels not all rendered

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #720078

    joelmellin
    Participant

    Hello WoodMart support,

    After updating to WoodMart 8.5.0, I noticed that one of my product attribute labels is no longer displayed on product pages/product cards, even though it is correctly enabled and assigned.

    The issue concerns product attribute labels shown as product badges.

    Environment:

    * WoodMart parent theme: 8.5.0
    * WoodMart child theme active
    * WooCommerce product attributes are used for product labels
    * “Show attribute label on products” is enabled for both affected attributes
    * Product labels are enabled under Theme Settings → Shop → Product labels

    Example product:

    * Product ID: 25582
    * SKU: 11805
    * Product: Pistachios
    * Attribute pa_ursprung: Uzbekistan
    * Attribute pa_minst-hallbar-till: 2027-05

    Both attributes are correctly assigned to the product and both are visible WooCommerce product attributes.

    When I tested this directly in PHP, woodmart_get_product_attributes_label() returned both attribute labels correctly:

    `html
    <span class=”attribute-label label-term-uzbekistan label-attribute-pa_ursprung”>Uzbekistan</span>
    <span class=”attribute-label label-term-2027-05 label-attribute-pa_minst-hallbar-till”>2027-05</span>
    `

    However, when woodmart_product_label() renders the final product label HTML, only one of the attribute labels is output:

    `html
    <span class=”attribute-label product-label wd-shape-round-sm label-term-2027-05 label-attribute-pa_minst-hallbar-till”>2027-05</span>
    `

    The pa_ursprung label is omitted, even though WoodMart’s own helper function has already found and generated it.

    The relevant functions are located here:

    `text
    wp-content/themes/woodmart/inc/integrations/woocommerce/template-tags.php
    `

    Specifically:

    * woodmart_product_label() around lines 1813–1849
    * woodmart_get_product_attributes_label() around lines 2008–2048

    As a temporary workaround, I added a small MU plugin using the woodmart_product_label_output filter. The workaround calls woodmart_get_product_attributes_label() again and appends any missing enabled attribute labels that are not already present in the $output array.

    The workaround successfully restores both labels:

    `html
    <span class=”attribute-label product-label wd-shape-round-sm label-term-2027-05 label-attribute-pa_minst-hallbar-till”>2027-05</span>
    <span class=”attribute-label product-label wd-shape-round-sm label-term-uzbekistan label-attribute-pa_ursprung”>Uzbekistan</span>
    `

    It seems that WoodMart 8.5.0 correctly detects all enabled attribute labels through woodmart_get_product_attributes_label(), but the final label rendering through woodmart_product_label() only outputs one of them.

    Could you please investigate this and fix it in an upcoming WoodMart update, so that all enabled attribute product labels are rendered as expected?

    Thank you.

    #720102

    Serg Sokhatskyi
    Keymaster
    Xtemos team

    Hi there,
    Thanks for reaching out.

    We checked the example product you mentioned (Pistachios, ID 25582) and both attribute labels are rendered on our side. Screenshot: https://gyazo.com/618ac9cc5f1bb6b6950df4755e3b4e5a

    Could you please clarify:
    – Where exactly the label is missing for you (single product page, product grid/card, specific archive)?
    – A front-end URL where we can see the issue.

    Once we can reproduce it on a specific page, we’ll investigate further.

    Kind regards,
    XTemos Studio

    #720105

    joelmellin
    Participant

    Hi,

    The reason both labels are visible on your side now is that I have, as I wrote, currently applied a temporary MU plugin workaround on the live site. That workaround uses the woodmart_product_label_output filter to add back the missing enabled attribute labels.

    So the current front-end view is not the original broken state anymore.

    Before applying the workaround, the issue was as follows:

    Example product:

    * Product ID: 25582
    * SKU: 11805
    * Product: Pistachios
    * URL: https://mellins.nu/produkter/notter-och-fron/notter/pistagenotter-pistasch-naturella-utan-skal-obesprutade/

    Both attributes were correctly assigned to the product:

    * pa_ursprung: Uzbekistan
    * pa_minst-hallbar-till: 2027-05

    Both attributes also had “Show attribute label on products” enabled.

    When testing directly in PHP, WoodMart’s helper function returned both labels correctly:

    `php
    woodmart_get_product_attributes_label()
    `

    returned:

    `html
    <span class=”attribute-label label-term-uzbekistan label-attribute-pa_ursprung”>Uzbekistan</span>
    <span class=”attribute-label label-term-2027-05 label-attribute-pa_minst-hallbar-till”>2027-05</span>
    `

    However, the final output from:

    `php
    woodmart_product_label()
    `

    only rendered this label:

    `html
    <span class=”attribute-label product-label wd-shape-round-sm label-term-2027-05 label-attribute-pa_minst-hallbar-till”>2027-05</span>
    `

    The pa_ursprung label was missing from the final rendered label output, even though woodmart_get_product_attributes_label() had already found it.

    The relevant functions are in:

    `text
    wp-content/themes/woodmart/inc/integrations/woocommerce/template-tags.php
    `

    Specifically:

    * woodmart_product_label() around lines 1813–1849
    * woodmart_get_product_attributes_label() around lines 2008–2048

    The temporary workaround I added is located here:

    `text
    wp-content/mu-plugins/mellins-woodmart-attribute-labels.php
    `

    It simply calls woodmart_get_product_attributes_label() again through the woodmart_product_label_output filter and appends any missing enabled attribute labels that are not already present in $output.

    After applying this workaround, both labels are rendered again, which is what you are seeing now.

    Could you please investigate why WoodMart 8.5.0, without this workaround, detects both enabled attribute labels through woodmart_get_product_attributes_label() but only outputs one of them through woodmart_product_label()?

    Kind regards

    #720112

    Serg Sokhatskyi
    Keymaster
    Xtemos team

    Please, remove the fix temporarily so we can investigate the problem on your website.

    #720116

    joelmellin
    Participant

    Hi,

    I have now removed the temporary MU plugin workaround and cleared the cache.

    Please note that the front-end may still show cached HTML for a while, but the issue is now again reproducible at PHP level on the site.

    I verified that the workaround is no longer active:

    `text
    wp plugin list –status=must-use
    `

    The MU plugin mellins-woodmart-attribute-labels.php is no longer present.

    I also checked the callbacks on the woodmart_product_label_output filter. The only remaining callback is WoodMart’s own callback:

    `text
    XTS\Modules\Custom_Labels\Frontend::render_labels
    /home/mellins/domains/mellins.nu/public_html/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/custom-labels/class-frontend.php:49-94
    `

    Then I tested the output of woodmart_product_label() directly for the product:

    * Product ID: 25582
    * SKU: 11805
    * URL: https://mellins.nu/produkter/notter-och-fron/notter/pistagenotter-pistasch-naturella-utan-skal-obesprutade/

    The result is that the origin attribute label is missing from the final WoodMart label output:

    `text
    Har Ursprung/Uzbekistan? NEJ
    Har Minst hållbar till? JA
    `

    The generated output only contains the pa_minst-hallbar-till label, while the pa_ursprung label is not rendered.

    This means the issue is now reproducible without my workaround. The product has both attributes assigned, and both attributes are enabled as product labels, but WoodMart’s final woodmart_product_label() output only renders one of them.

    Please investigate why WoodMart’s final product label rendering omits pa_ursprung, even though the attribute exists on the product and is enabled as a product label.

    Kind regards

    #720142

    Serg Sokhatskyi
    Keymaster
    Xtemos team

    Hello,

    You can fix this by applying patch #720140. Please follow these steps:

    1. Go to Dashboard > WoodMart > Patcher
    2. Find the corresponding patch in the list
    3. Click the Apply button

    Please let us know if this resolves the issue.

    Best regards

    #720208

    joelmellin
    Participant

    Hi,

    Thank you. I have applied the patch and tested it via SSH.

    The temporary MU plugin workaround is no longer active. The only remaining callback on woodmart_product_label_output is now WoodMart’s own callback:

    `text
    XTS\Modules\Custom_Labels\Frontend::render_labels
    `

    I tested the affected product again:

    * Product ID: 25582
    * SKU: 11805

    The final woodmart_product_label() output now contains both attribute labels:

    `text
    pa_ursprung: yes
    pa_minst-hallbar-till: yes
    `

    I also tested 30 published products that have both attributes assigned, and all of them returned both labels correctly.

    A frontend cache-bypass test also confirms that both labels are now rendered in the product labels HTML.

    So the patch appears to solve the issue.

    Could you please confirm whether this fix will be included in the next official WoodMart update? I want to make sure the fix will not be overwritten by a future theme update.

    Kind regards

    #720256

    Serg Sokhatskyi
    Keymaster
    Xtemos team

    Sure, we will include this fix in our next theme update. Thank you for the feedback.

    Topic closed.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘WoodMart 8.5.0: attribute product labels not all rendered’ is closed to new replies.