Skip to content

Instantly share code, notes, and snippets.

@patrickposner
Last active July 18, 2018 12:03
Show Gist options
  • Select an option

  • Save patrickposner/e378447df33e7be39c10a6a6ec52be81 to your computer and use it in GitHub Desktop.

Select an option

Save patrickposner/e378447df33e7be39c10a6a6ec52be81 to your computer and use it in GitHub Desktop.
public function dhvc_woo_product_page_price_shortcode( $atts, $content = null ) {
global $post, $product;
extract( $this->_shortcode_atts( array(
'el_class' => ''
), $atts ) );
ob_start();
if ( ! empty ( $el_class ) ) {
echo '<div class="' . $el_class . '">';
}
if ( dhvc_woo_product_page_is_jupiter_theme() ) {
?>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<div itemprop="price" class="mk-single-price"><?php echo $product->get_price_html(); ?></div>
<meta itemprop="priceCurrency" content="<?php echo get_woocommerce_currency(); ?>"/>
<link itemprop="availability"
href="http://schema.org/<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>"/>
</div>
<?php
} else {
if ( $product->is_type( 'variable' ) ) {
woocommerce_template_single_price();
} else {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
do_action( 'woocommerce_single_product_summary' );
}
}
if ( ! empty ( $el_class ) ) {
echo '</div>';
}
return ob_get_clean();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment