Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliaamosova/e9339658a4442f911383eb092c2c292a to your computer and use it in GitHub Desktop.
Save juliaamosova/e9339658a4442f911383eb092c2c292a to your computer and use it in GitHub Desktop.
Display a short description of Mix & Match Product contents
/** Add the following line to the 'wc-mnm-template-hooks.php' file */
add_action( 'woocommerce_mnm_row_item_description', 'woocommerce_template_mnm_product_description' );
***********************************
/** Add the following function to the 'wc-mnm-template-functions.php' file */
if ( ! function_exists( 'woocommerce_template_mnm_product_description' ) ) {
/**
* Get the MNM item product description
*
* @access public
* @return void
*/
function woocommerce_template_mnm_product_description( $mnm_product ) {
wc_get_template(
'single-product/mnm/mnm-product-description.php',
array(
'mnm_product' => $mnm_product,
),
'',
WC_Mix_and_Match()->plugin_path() . '/templates/'
);
}
}
***************************************
/** Create a new file called 'mnm-product-description.php'
* and place it in the following directory
* 'single-product/mnm/mnm-product-description.php' */
<?php
/**
* MNM Item Product Description
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ){
exit; // Exit if accessed directly
}
?>
<div class="mnm_product">
<?php echo $mnm_product->get_short_description();?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment