Long Description Shortcode for Woocommerce
Last updated
Last updated
Would you like to include a detailed and long description of your product in a custom accordion rather than using the default style of your WordPress theme? So, this article is for you.
Adding this code to your WooCommerce site is easy and will allow you to create a shortcode to display the product description for any product.
Here are the steps you should take to add the code:
Log into your WordPress dashboard and navigate to the ‘Appearance’ section.
Click on the ‘Editor’ option.
In the right-hand pane, select the ‘functions.php’ file.
Copy and paste the code snippet provided above into the file.
Click on the ‘Update File’ button to save your changes.
Once you’ve saved the changes to the functions.php file, you will now be able to use the shortcode [product_description]
wherever you need to display the product description. And, you’re also able to enter the product’s ID in the shortcode (e.g. ‘[product_description id=123]
’) to get the exactly Product ID. In case you’re adding it directly to the product page, no need to add the product_id.
That’s it! You’ve now successfully added the code snippet to your WooCommerce site.