• Resolved dannieaj

    (@dannieaj)


    Hey! I have a bit of a weird request. We have a customer who have builder products, but they also want “pre packaged products” that they made themself (single products). They requested, that there also is the ability to go directly to the builder from this single product – my thought was inserting the shortcode and ID for the given product on the single product page. This, however, does not work, and the builder does not open (nor display if inserted directly). Is this not a viable solution? My thought was that since it is a single product distinct from the builder, there might be conflicts. Is this at all doable, or is the solution to link to the builder product instead?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Contributor Marc Lacroix

    (@marcusig)

    Hi there,

    This should be possible. Could you share a link to the single product?

    You can also send the URL here if you would rather not share it publicly.

    Marc

    Thread Starter dannieaj

    (@dannieaj)

    Hey Marc, thanks for the quick reply. I have sent a link in the form you linked – there are multiple buttons Im testing on, neither opening any!

    Plugin Contributor Marc Lacroix

    (@marcusig)

    Thanks. The issue is that the configurator scripts aren’t loaded, so you’ll have to force this.

    There are several ways to do this:

    • Add the custom field mkl_load_configurator_on_page with a value of 1 to the product where you want to add the button
    • or use the filter load_configurator_on_page to force the scripts to load. This solution might be more appropriate if you have more than a couple of products to do.
      e.g. the following will load the scripts everywhere:
    add_filter( 'load_configurator_on_page', '__return_true' );

    Though you may want to use a logic which will load the scripts only on specific products, instead of everywhere.

    Thread Starter dannieaj

    (@dannieaj)

    Ah I see – are there any reason why they are not loaded? Or that’s the nature of it? Else Ill try look into conditional page loading for sure!

    Plugin Contributor Marc Lacroix

    (@marcusig)

    are there any reason why they are not loaded?

    Yes: by default the scripts are only loaded on configurable product pages, or when a shortcode is found in the page content. If the shortcode is somewhere else, like a widget or an other location, it is not found, and the scripts aren’t loaded.

    In your case the shortcode appears to be in the short description of the product, so it’s not detected. Maybe if you put it in the full description as well it will work, but using the custom field or the filter would be more appropriate.

    Thread Starter dannieaj

    (@dannieaj)

    Hmm weird – it should not be in the short description, as it is dropped in via the Shortcode widget in Elementor. So that’s strange!

    Thread Starter dannieaj

    (@dannieaj)

    I inserted the PHP code, but now it seems that the buttons disappear when I load the product

    Plugin Contributor Marc Lacroix

    (@marcusig)

    Hmm weird – it should not be in the short description, as it is dropped in via the Shortcode widget in Elementor. So that’s strange!

    The “post content” in a product is usually displayed in the “description” tab. So possibly Elementor stores this in a different database field.

    Thread Starter dannieaj

    (@dannieaj)

    Yeah that might be it. Any clue why it disappears when inserting the filter?

    Plugin Contributor Marc Lacroix

    (@marcusig)

    I inserted the PHP code, but now it seems that the buttons disappear when I load the product

    I see, this looks like a conflict with the Variable product addon, which hides the button until a configurable variation is selected.

    Thread Starter dannieaj

    (@dannieaj)

    Ah, yes that makes sense. I’ll have to dig down into that, and see what I can do. Thanks for the great support though, and have a lovely weekend!

    Plugin Contributor Marc Lacroix

    (@marcusig)

    I’ve just sent you an updated version of the addon, which should hopefully fix that issue.

    Thread Starter dannieaj

    (@dannieaj)

    Hey Marc – that worked perfectly! Thanks a lot for saving me quite the headache – it opens just as it is supposed to now!

    Thread Starter dannieaj

    (@dannieaj)

    I have another question for the addon – is it fine I ask it here, or is it better I create another thread? It does not have semblance to the question asked here

    Plugin Contributor Marc Lacroix

    (@marcusig)

    Great!

    Please use the premium support form for addon related questions, as we’re not allowed to support premium products here.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Inserting shortcode on another product’s page’ is closed to new replies.