• Resolved Imageglov

    (@glov)


    Hello,

    I try to display a 3D model (*.glb) using google’s model viewer inside a product tab. However, after inserting the code into the text editor, all <script> and <model-viewer> tags and their contents get removed when saving the product. Enabling/disabling the plugin setting “Use custom content rendering” doesn’t seem to have an effect. The code itself works fine if used in the default product description field or any other page.

    Is there a way to enable using scripts or the google model viewer inside tabs or is there another way to display 3D models inside a tab?

    Thank you for your help.

    • This topic was modified 1 month, 2 weeks ago by Imageglov.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support ImageBarn2 Plugin Support

    (@barn2pluginsupport)

    Hi, @glov .

    Thanks for asking!

    Given that your code works in the main product description but is removed in the tab editor, the tab field is likely sanitizing disallowed tags.

    A few options to consider based on our guidance:

    • Add the 3D model in the product description (where you confirmed it works) and keep the tab for supporting text only.
    • If your theme or another plugin provides shortcodes that render the 3D viewer, you could place a shortcode in the tab. Our docs suggest using shortcodes to add more complex content in tabs: https://barn2.com/kb/product-tabs-page-builders/
    • If your 3D viewer can be embedded via iframe, you can try embedding the iframe HTML in the tab instead of script tags. This works in most cases.

    I will consult this with our development team as well.

    I’ll keep you posted.

    Best regards,
    Adrian

    Plugin Support ImageBarn2 Plugin Support

    (@barn2pluginsupport)

    Hi, @glov .

    Thanks for waiting!

    According to our developer, it should work find, as it’s working fine on their end, and they can see the result on the front end:

    They suspect the issue may be due to the user role not having permission to add those tags, or a third-party plugin/security setting stripping them. They suggest testing by adding the script tag in a standard post or product.

    Please let me know if this works for you.

    Best regards,
    Adrian

    Thread Starter Imageglov

    (@glov)

    Thank you for your help.

    Using the plugin “Code Snippets” solved the issue. Using php code that loads google’s 3D model viewer in a snippet and then inserting the generated shortcode inside the product’s custom tab enabled displaying the model there.

    Best regards.

    Plugin Support ImageBarn2 Plugin Support

    (@barn2pluginsupport)

    Hello, glov (@glov).

    Thanks for the update. Well done for coming up with that workaround, by using the Code Snippets plugin to generate a shortcode that renders the 3D model viewer.

    Please let me know if there’s anything else that we may assist you with.

    Best regards,
    Edge

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.