Answers for "product woocommerce properties"

1

is product category woocommerce

if( is_product_category() ) {
	// yay, we are on a product category page!
} else {
 
}
Posted by: Guest on October-30-2020
1

how to get woocommerce product price

function so_30165014_price_shortcode_callback( $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 = "price = " . $_product->get_price();
    }
    return $html;
}
add_shortcode( 'woocommerce_price', 'so_30165014_price_shortcode_callback' );
Posted by: Guest on May-21-2020

Code answers related to "product woocommerce properties"

Browse Popular Code Answers by Language