YOOtheme Pro is here! The best WordPress and Joomla theme. Learn more

Avatar getyoowoo asked

Woocommerce product PRICE in Widgetkit 2

Hi there,

I just love the new (not so new anymore) Widgetkit 2. Everytime I use it I say to my self: "This is clever thinking!"

But one thing... I honestly allmost can't beleve that this is missing: Woocommerce product PRICE support in Widgetkit 2

Super sweet to display recent products and all but isn't PRICE one of the key features to display? I hope I'm missing something :)

Thanks again for your great stuff and hope to hear from you soon :)


Nobody?

  • WordPress
  • Widgetkit
  • General Question

Edited

5 Answers

0

Avatar majd.malki answered

im wondering the same thing, i cant figure out how to show the woocommerce product price in widgetkit.
or maybe this is supposed to show by deafault?
Anyone?

0

Avatar getyoowoo answered

Just add this to yout theme's functions.php file:

function yw_product_price_function( $atts ) {  
    $atts = shortcode_atts( array(  
        'id' => null,  
    ), $atts, 'bartag' );  

    $html = '';  

    if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){  
        $_product = wc_get_product( $atts['id'] );  
        $html = $_product->get_price_html();  
    }  
    return $html;  
}  
add_shortcode( 'yw_product_price', 'yw_product_price_function' );

Then use: [yw_product_price id='99'] in any post, page or whatever :)

In this example 99 should be replaced the the product id of your liking.

Need more of this stuff, like product name, url, image or whatever? Find us as https://yoowoo.nl

Edited

0

Avatar philipp Yootheme answered

Hi,
just found this and wanted to say that the price is available within the widgetkit, the "problem" is that the default widgets don't render this. So what you can do is create a custom widget via a copy of an existing one ( or just a totally new one ) and render the price for example like this:

<div class="uk-panel-badge"><?php echo $item['price']; ?></div>

Kind Regards
Philipp

Edited

Know someone who can answer? Share a link to this question via email or twitter.