Dynamically Render Short Codes, Is this possible?
-
I have a JavaScript click event that renders a preview per item that the user wants to see more information. Upon my click event I send all details to the function called “More Info”
Within that More Info function I want to put the shortcode [wp_cart_button name=”PRODUCT-NAME” price=”${data[“price”]}”]
${data[“price”]} has the information on the price of the product. However, when I insert this into page I keep getting the “Error! You must specify a price for your product in the shortcode.”
I don’t know what I need to do. Is there a way I can just send the string “[wp_cart_button name=”PRODUCT-NAME” price=”PRODUCT-PRICE”]” with the correct values? Will WordPress render the button then?
The reason why I can’t hardcode the values is my website sells large quantity of products anywhere from 100,000 – 120,000. Having to update these pages is not practical in my case. This the reason why I believe this plugin so far is my closest solution.
Any suggestions how to render the shortcodes dynamically?
Thank you!
The topic ‘Dynamically Render Short Codes, Is this possible?’ is closed to new replies.