Problem:
The issue here is that the user wanted to check if a product is featured and display some special output for featured products.
Solution:
Actually you should be able to tell if a product is feature or not by using this shortcode.
// Add Shortcode function featured_product( $atts ) { // Attributes $atts = shortcode_atts( array( 'product_id' => '', ), $atts ); $product = wc_get_product($atts['product_id']); return $product->is_featured(); } add_shortcode( 'featured_product', 'featured_product' );
Add it to your functions.php file and you can use it by doing this [featured_product product_id='[wpv-post-id]'] and it will return 1 or 0 if the product is featured or not.
Just add featured_product to the 3rd party shortcode arguments for this to work in our views conditionals.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
This topic contains 3 replies, has 2 voices.
Last updated by 6 years, 8 months ago.
Assisted by: Shane.