Ecommerce Shopify WordPress Discussion

Add Shortcode to include a PHP file which includes HTML + JavaScript to use inside WordPress pages

I created a PHP file which includes HTML and JavaScript for a dropdown widget and output estimated shipping price and time. I'm trying to create a shortcode to use for Wordpress "shortcode" widget. But when I try to save the page, this error pops up everytime: Updating failed. The response is not a valid JSON response. Moreover, after saving, the dropdown jumps to the top of the page, and at the section where I placed the shortcode, value 1 is showing. Here's my code inside function.php function shippingcal(){ return include ("KB/widget/shipping-calculator.php"); }; add_shortcode('sc_shippingcal', 'shippingcal'); Inside my PHP file does contain JavaScript with many variables and functions, I don't know if that's the problem here or not though.
"Updating failed. The response is not a valid JSON response." usually this message comes when you have a lot of post revisions. try clearing revisions and then try to update. you can clear post revisions via "wp optimize" plugin. Note: Make sure to make a backup before using wp optimize.

December 30, 2023

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.