I want to add a button (that will open an INFO popup screen with info about a certain option in a woocommerce variable product), all that can be easily created with a plugin that converts the whole thing to a shortcode, the problem is to insert it into the products page, this will run on hundreds of products so i cannot simply add it on the HTML directly.

I will attach below the CSS code that works to add an IMAGE to where i want, but im guessing we cant use the "Content" CSS to add shortcodes or so i tried..

Please advice me how can i insert a shortcode in that EXACT location (that is only one of the lines that will use the INFO button, each variable title will get a different one)

.label [for=pa_size-of-product]:before {
    content: url(shortcode would go here, but only images or text work with this option) !important;


  • It should be more helpful if you post an actual URL with place where you want to add the code. – twelvell Jun 14 '19 at 22:44
  • H Twelvell, here is a link to a dummy product, basically i want to place the shortcode (which will be a button that opens a modal, created in Elementor Pro) in the place of the Facebook icon, which i placed there via CSS so you can easily see the spot i want, basically i will do the same on all the variable titles, with different shortcodes, thanks! – Marcio da Silva Jun 15 '19 at 9:01
  • Forgot the link haha - back.frapids.pt/produto/test-01/… – Marcio da Silva Jun 15 '19 at 9:01

You can’t do what you’re trying to do.

If you want to output a shortcode you need to do it in the content or template. You can’t place one with CSS.

|improve this answer|||||
  • Hi Jacob, yes i know i cant put shortcodes via CSS (only text and image), thats why im asking how can i insert it via function.php or something else, i know some html/css, but zero at php haha :) Also to point out, i cant do it directly on the HTML page because this will run on hundreds of products – Marcio da Silva Jun 15 '19 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.