Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

Can I use existing data for MPN, such as a sku

Home / Forums / Virtue Theme / Can I use existing data for MPN, such as a sku

This topic is: Not Resolved
[Not Resolved]
Posted in: Virtue Theme
August 3, 2014 at 3:03 pm

Hi ben,
how to use a coding change like the one below?

use a snippet like this in your theme functions.php:(for creating feeds for woocommerce)

function add_sku_as_mpn ( $elements, $product_id ) {
$product = get_product($product_id);
if ( ! $product )
return $elements;
$sku = $product->get_sku();
if ( empty( $sku ) )
return $elements;
$elements[‘mpn’] = array( $sku );
return $elements;
}
add_filter( ‘woocommerce_gpf_elements’, ‘add_sku_as_mpn’, 11, 2 );

  • The forum ‘Virtue Theme’ is closed to new topics and replies.