Snippets

Visser Labs Adding static Product fields to the Products export type

Created by Michael Visser last modified
<?php
function custom_woo_ce_extend_product_fields( $fields ) {

    $fields[] = array(
        'name' => 'static_field',
        'label' => __( 'Static Field', 'woo_ce' ),
        'hover' => __( 'Static Field within functions.php', 'woo_ce' )
    );
    return $fields;

}
add_filter( 'woo_ce_product_fields', 'custom_woo_ce_extend_product_fields' );

function custom_woo_ce_extend_product_item( $product, $product_id ) {

    $product->static_field = 'Static value';
    return $product;

}
add_filter( 'woo_ce_product_item', 'custom_woo_ce_extend_product_item', 10, 2 );
?>

Comments (0)