Woocommerce short description info with code
-
(System status: https://toyzi.be/status.txt)
To display delivery info in the short description of each single product (some with with variations) I put following code in the functions.php file.
function myscript_short_description() { $product = wc_get_product(); $shipping_class = $product->get_shipping_class(); switch ( $shipping_class ) { case 'free-standard-shipping': echo "<p><b>Delivery Term:</b></p><p><small>(Only shipping to following countries)</small></p>"; echo "<p>Belgium: 27 days<br>The Netherlands: 22 days<br>Germany: 32 days</p><p> </p>"; break; case 'free-dhl-shipping': echo "<p><b>Delivery Term:</b></p><p><small>(Only shipping to following countries)</small></p>"; echo "<p>Belgium: 8-18 days<br>The Netherlands: 7-14 days<br>Germany: 8-17 days</p><p> </p>"; break; } } add_filter( 'woocommerce_short_description', 'myscript_short_description', 20 );
This is an example of the first case, but it should only be displayd once.
Normally when you put something manually in the short description area it is displayed only once indeed.
My questions:
1. Maybe “woocommerce_short_description” has to be something else?
2. If there is a plugin doing the same and with preference more extended let me know which one but until now I didn’t find any.- This topic was modified 4 years, 2 months ago by . Reason: changing a detail
- This topic was modified 4 years, 2 months ago by .
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Woocommerce short description info with code’ is closed to new replies.